<s> import unittest <EOL> import utils <EOL> from gitpy import LocalRepository <EOL> from gitpy import clone <EOL> class TestWorkflows ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . repo = utils . create_repo ( ) <EOL> def tearDown ( self ) : <EOL> utils . delete_repository ( self . repo ) <EOL> def assertReposEqual ( self , repo1 , repo2 ) : <EOL> self . assertEquals ( utils . get_repo_contents ( repo1 ) , <EOL> utils . get_repo_contents ( repo2 ) ) <EOL> def testCloneModifyPush ( self ) : <EOL> new_repo = LocalRepository ( utils . get_temporary_location ( ) ) <EOL> new_repo . clone ( self . repo ) <EOL> prev_branch = self . repo . getCurrentBranch ( ) <EOL> self . repo . checkout ( self . repo . createBranch ( '<STR_LIT>' ) ) <EOL> self . assertReposEqual ( self . repo , new_repo ) <EOL> utils . commit_change ( new_repo ) <EOL> new_repo . push ( ) <EOL> self . repo . checkout ( prev_branch ) <EOL> self . assertReposEqual ( self . repo , new_repo ) <EOL> utils . delete_repository ( new_repo ) <EOL> def testCloneRebaseModifyPush ( self ) : <EOL> new_repo = LocalRepository ( utils . get_temporary_location ( ) ) <EOL> new_repo . clone ( self . repo ) <EOL> prev_branch = self . repo . getCurrentBranch ( ) <EOL> self . repo . checkout ( self . repo . createBranch ( '<STR_LIT>' ) ) <EOL> self . assertReposEqual ( self . repo , new_repo ) <EOL> utils . commit_change ( self . repo ) <EOL> utils . commit_change ( new_repo ) <EOL> new_repo . fetch ( ) <EOL> new_repo . rebase ( '<STR_LIT>' ) <EOL> new_repo . push ( ) <EOL> self . repo . checkout ( prev_branch ) <EOL> self . assertReposEqual ( self . repo , new_repo ) <EOL> utils . delete_repository ( new_repo ) <EOL> def testCloneModifyPushToBranch ( self ) : <EOL> new_repo = clone ( self . repo , utils . get_temporary_location ( ) ) <EOL> prev_branch = self . repo . getCurrentBranch ( ) <EOL> self . repo . checkout ( self . repo . createBranch ( '<STR_LIT>' ) ) <EOL> branch = new_repo . createBranch ( '<STR_LIT>' ) <EOL> new_repo . checkout ( branch ) <EOL> utils . commit_change ( new_repo ) <EOL> new_repo . push ( self . repo , fromBranch = branch , toBranch = '<STR_LIT>' ) <EOL> self . repo . checkout ( prev_branch ) <EOL> self . assertTrue ( self . repo . getBranchByName ( '<STR_LIT>' ) . getHead ( ) == new_repo . getHead ( ) ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
