#NEWLINE# @ mock . patch ( 'esrally.mechanic.supplier.GitRepository.head_revision' , autospec = True ) #NEWLINE# @ mock . patch ( 'esrally.mechanic.supplier.GitRepository.pull_revision' , autospec = True ) #NEWLINE# @ mock . patch ( 'esrally.mechanic.supplier.GitRepository.is_cloned' , autospec = True ) #NEWLINE# @ mock . patch ( 'esrally.utils.process.run_subprocess' ) #NEWLINE# def test_checkout_revision( self , mock_run_subprocess , mock_is_cloned , mock_pull_revision , mock_head_revision ) : #NEWLINE# #INDENT# cfg = config . Config ( ) #NEWLINE# cfg . add ( config . Scope . application , 'source' , 'local.src.dir' , '/src' ) #NEWLINE# cfg . add ( config . Scope . application , 'source' , 'remote.repo.url' , 'some-github-url' ) #NEWLINE# cfg . add ( config . Scope . application , 'source' , 'revision' , '67c2f42' ) #NEWLINE# mock_is_cloned . return_value = True #NEWLINE# mock_head_revision . return_value = 'HEAD' #NEWLINE# git = supplier . GitRepository ( cfg ) #NEWLINE# s = supplier . Supplier ( cfg , git ) #NEWLINE# s . fetch ( ) #NEWLINE# mock_is_cloned . assert_called_with ( git ) #NEWLINE# mock_pull_revision . assert_called_with ( git , '67c2f42' ) #NEWLINE# mock_head_revision . assert_called_with ( git )