<s> TEST_NAME = "<STR_LIT>" <EOL> BRANCH_NAME = [ TEST_NAME + "<STR_LIT>" , <EOL> TEST_NAME + "<STR_LIT>" ] <EOL> UPSTREAM_NAME = [ name + "<STR_LIT>" <EOL> for name in BRANCH_NAME ] <EOL> SUMMARY = TEST_NAME <EOL> ORIGINAL_SHA1 = "<STR_LIT>" <EOL> REVIEWED_SHA1 = [ ] <EOL> UPSTREAM_SHA1 = [ "<STR_LIT>" , <EOL> "<STR_LIT>" ] <EOL> def to ( name ) : <EOL> return testing . mailbox . ToRecipient ( "<STR_LIT>" % name ) <EOL> def about ( subject ) : <EOL> return testing . mailbox . WithSubject ( subject ) <EOL> repository . run ( [ "<STR_LIT>" , UPSTREAM_NAME [ <NUM_LIT:0> ] , UPSTREAM_SHA1 [ <NUM_LIT:0> ] ] ) <EOL> repository . run ( [ "<STR_LIT>" , UPSTREAM_NAME [ <NUM_LIT:1> ] , UPSTREAM_SHA1 [ <NUM_LIT:1> ] ] ) <EOL> with repository . workcopy ( ) as work : <EOL> work . run ( [ "<STR_LIT>" , "<STR_LIT>" , BRANCH_NAME [ <NUM_LIT:0> ] , UPSTREAM_SHA1 [ <NUM_LIT:0> ] ] ) <EOL> work . run ( [ "<STR_LIT>" , ORIGINAL_SHA1 ] ) <EOL> work . run ( [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> REVIEWED_SHA1 . append ( work . run ( [ "<STR_LIT>" , "<STR_LIT>" ] ) . strip ( ) ) <EOL> work . run ( [ "<STR_LIT>" , "<STR_LIT>" , BRANCH_NAME [ <NUM_LIT:1> ] , UPSTREAM_SHA1 [ <NUM_LIT:1> ] ] ) <EOL> work . run ( [ "<STR_LIT>" , ORIGINAL_SHA1 ] ) <EOL> work . run ( [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> REVIEWED_SHA1 . append ( work . run ( [ "<STR_LIT>" , "<STR_LIT>" ] ) . strip ( ) ) <EOL> with_class = testing . expect . with_class <EOL> extract_text = testing . expect . extract_text <EOL> def check_tracking ( branch_name , disabled = False ) : <EOL> def check ( document ) : <EOL> class_names = [ "<STR_LIT>" ] <EOL> if disabled : <EOL> class_names . append ( "<STR_LIT>" ) <EOL> p_tracking = document . find ( "<STR_LIT:p>" , attrs = with_class ( * class_names ) ) <EOL> testing . expect . check ( "<STR_LIT>" , extract_text ( p_tracking ) ) <EOL> if not disabled : <EOL> testing . expect . check ( "<STR_LIT>" , p_tracking [ "<STR_LIT:class>" ] ) <EOL> code_branch = document . findAll ( "<STR_LIT:code>" , attrs = with_class ( "<STR_LIT>" ) ) <EOL> testing . expect . check ( <NUM_LIT:2> , len ( code_branch ) ) <EOL> testing . expect . check ( branch_name , extract_text ( code_branch [ <NUM_LIT:1> ] ) ) <EOL> code_repository = document . findAll ( "<STR_LIT:code>" , attrs = with_class ( "<STR_LIT>" ) ) <EOL> testing . expect . check ( <NUM_LIT:2> , len ( code_repository ) ) <EOL> testing . expect . check ( repository . url , extract_text ( code_repository [ <NUM_LIT:1> ] ) ) <EOL> return check <EOL> SETTINGS = { "<STR_LIT>" : <EOL> "<STR_LIT>" } <EOL> with testing . utils . settings ( "<STR_LIT>" , SETTINGS ) , frontend . signin ( "<STR_LIT>" ) : <EOL> result = frontend . operation ( <EOL> "<STR_LIT>" , <EOL> data = { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : repository . url , <EOL> "<STR_LIT>" : BRANCH_NAME [ <NUM_LIT:0> ] , <EOL> "<STR_LIT>" : "<STR_LIT>" + UPSTREAM_NAME [ <NUM_LIT:0> ] } , <EOL> expect = { <EOL> "<STR_LIT>" : REVIEWED_SHA1 [ <NUM_LIT:0> ] , <EOL> "<STR_LIT>" : UPSTREAM_SHA1 [ <NUM_LIT:0> ] } ) <EOL> instance . gc ( "<STR_LIT>" ) <EOL> commit_ids = result [ "<STR_LIT>" ] <EOL> result = frontend . operation ( <EOL> "<STR_LIT>" , <EOL> data = { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" + TEST_NAME , <EOL> "<STR_LIT>" : SUMMARY , <EOL> "<STR_LIT>" : commit_ids , <EOL> "<STR_LIT>" : { "<STR_LIT>" : repository . url , <EOL> "<STR_LIT:name>" : BRANCH_NAME [ <NUM_LIT:0> ] } } ) <EOL> review_id = result [ "<STR_LIT>" ] <EOL> trackedbranch_id = result [ "<STR_LIT>" ] <EOL> mailbox . pop ( <EOL> accept = [ to ( "<STR_LIT>" ) , <EOL> about ( "<STR_LIT>" + SUMMARY ) ] ) <EOL> instance . synchronize_service ( "<STR_LIT>" ) <EOL> frontend . page ( <EOL> "<STR_LIT>" % review_id , <EOL> expect = { <EOL> "<STR_LIT>" : check_tracking ( BRANCH_NAME [ <NUM_LIT:0> ] ) } ) <EOL> frontend . page ( <EOL> "<STR_LIT>" , <EOL> params = { <EOL> "<STR_LIT>" : review_id } ) <EOL> result = frontend . operation ( <EOL> "<STR_LIT>" , <EOL> data = { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : repository . url , <EOL> "<STR_LIT>" : BRANCH_NAME [ <NUM_LIT:1> ] , <EOL> "<STR_LIT>" : "<STR_LIT>" + UPSTREAM_NAME [ <NUM_LIT:1> ] } , <EOL> expect = { <EOL> "<STR_LIT>" : REVIEWED_SHA1 [ <NUM_LIT:1> ] , <EOL> "<STR_LIT>" : UPSTREAM_SHA1 [ <NUM_LIT:1> ] } ) <EOL> instance . gc ( "<STR_LIT>" ) <EOL> frontend . page ( <EOL> "<STR_LIT>" , <EOL> params = { <EOL> "<STR_LIT>" : review_id , <EOL> "<STR_LIT>" : BRANCH_NAME [ <NUM_LIT:1> ] , <EOL> "<STR_LIT>" : UPSTREAM_NAME [ <NUM_LIT:1> ] , <EOL> "<STR_LIT>" : REVIEWED_SHA1 [ <NUM_LIT:1> ] , <EOL> "<STR_LIT>" : UPSTREAM_SHA1 [ <NUM_LIT:1> ] } ) <EOL> frontend . operation ( <EOL> "<STR_LIT>" , <EOL> data = { <EOL> "<STR_LIT>" : review_id , <EOL> "<STR_LIT>" : REVIEWED_SHA1 [ <NUM_LIT:1> ] , <EOL> "<STR_LIT>" : UPSTREAM_SHA1 [ <NUM_LIT:1> ] } , <EOL> expect = { <EOL> "<STR_LIT>" : False , <EOL> "<STR_LIT>" : False } ) <EOL> frontend . operation ( <EOL> "<STR_LIT>" , <EOL> data = { <EOL> "<STR_LIT>" : review_id , <EOL> "<STR_LIT>" : REVIEWED_SHA1 [ <NUM_LIT:1> ] , <EOL> "<STR_LIT>" : UPSTREAM_SHA1 [ <NUM_LIT:1> ] , <EOL> "<STR_LIT>" : BRANCH_NAME [ <NUM_LIT:1> ] } ) <EOL> frontend . page ( <EOL> "<STR_LIT>" % review_id , <EOL> expect = { <EOL> "<STR_LIT>" : check_tracking ( BRANCH_NAME [ <NUM_LIT:1> ] ) } ) <EOL> mailbox . pop ( <EOL> accept = [ to ( "<STR_LIT>" ) , <EOL> about ( "<STR_LIT>" + SUMMARY ) ] ) <EOL> frontend . operation ( <EOL> "<STR_LIT>" , <EOL> data = { <EOL> "<STR_LIT>" : trackedbranch_id } ) <EOL> frontend . page ( <EOL> "<STR_LIT>" % review_id , <EOL> expect = { <EOL> "<STR_LIT>" : check_tracking ( BRANCH_NAME [ <NUM_LIT:1> ] , disabled = True ) } ) <EOL> frontend . operation ( <EOL> "<STR_LIT>" , <EOL> data = { <EOL> "<STR_LIT>" : trackedbranch_id } ) <EOL> frontend . page ( <EOL> "<STR_LIT>" % review_id , <EOL> expect = { <EOL> "<STR_LIT>" : check_tracking ( BRANCH_NAME [ <NUM_LIT:1> ] ) } ) </s>
