#NEWLINE# def test_create_or_update_local_repo_with_reference( self ) : #NEWLINE# #INDENT# test_settings = copy . deepcopy ( Settings ) #NEWLINE# test_settings [ 'git' ] [ 'use_local_mirror' ] = True #NEWLINE# test_settings [ 'git' ] [ 'local_mirror' ] = '/' #NEWLINE# expected_cwd = '/place/to/store/on-disk/git/repos/main-repository.0' #NEWLINE# with mock . patch . dict ( Settings , test_settings , clear = True ) : #NEWLINE# #INDENT# with mock . patch ( 'pushmanager.core.git.GitCommand' ) as GC : #NEWLINE# #INDENT# pushmanager . core . git . GitQueue . create_or_update_local_repo ( 0 , 'some_dev_name' , 'test_branch' , fetch = True ) #NEWLINE# calls = [ mock . call ( 'clone' , 'git://git.example.com/main-repository' , '--reference' , '/' , expected_cwd ) , mock . call ( ) . run ( ) , mock . call ( 'remote' , 'add' , 'some_dev_name' , 'git://git.example.com/devs/some_dev_name' , cwd = expected_cwd ) , mock . call ( ) . run ( ) , mock . call ( 'fetch' , '--prune' , 'some_dev_name' , '+refs/heads/test_branch:refs/remotes/some_dev_name/test_branch' , cwd = expected_cwd ) , mock . call ( ) . run ( ) , mock . call ( 'reset' , '--hard' , 'HEAD' , cwd = expected_cwd ) , mock . call ( ) . run ( ) , mock . call ( 'clean' , '-fdfx' , cwd = expected_cwd ) , mock . call ( ) . run ( ) , mock . call ( 'checkout' , 'some_dev_name/test_branch' , cwd = expected_cwd ) , mock . call ( ) . run ( ) , mock . call ( 'submodule' , '--quiet' , 'sync' , cwd = expected_cwd ) , mock . call ( ) . run ( ) , mock . call ( 'submodule' , '--quiet' , 'update' , '--init' , cwd = expected_cwd ) , mock . call ( ) . run ( ) ] #NEWLINE# GC . assert_has_calls ( calls )