#NEWLINE# def _test_get_file_exists( self , tool_name , revision , base_commit_id , expected_revision , expected_found ) : #NEWLINE# #INDENT# def _http_get( service , url , * args , **kwargs ) : #NEWLINE# #INDENT# expected_url = 'https://mydomain.beanstalkapp.com/api/repositories/myrepo/' #NEWLINE# if ( ( not base_commit_id ) and ( tool_name == 'Git' ) ) : #NEWLINE# #INDENT# expected_url += ( 'blob?id=%s&name=path' % expected_revision ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# expected_url += ( 'node.json?path=/path&revision=%s' % expected_revision ) #NEWLINE# #UNINDENT# self . assertEqual ( url , expected_url ) #NEWLINE# if expected_found : #NEWLINE# #INDENT# return ( b'{}' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise HTTPError ( ) #NEWLINE# #UNINDENT# #UNINDENT# account = self . _get_hosting_account ( ) #NEWLINE# service = account . service #NEWLINE# repository = Repository ( hosting_account = account , tool = Tool . objects . get ( name = tool_name ) ) #NEWLINE# repository . extra_data = { #NEWLINE# #INDENT# 'beanstalk_account_domain' : 'mydomain' , #NEWLINE# 'beanstalk_repo_name' : 'myrepo' , #NEWLINE# #UNINDENT# } #NEWLINE# service . authorize ( 'myuser' , 'abc123' , None ) #NEWLINE# self . spy_on ( service . client . http_get , call_fake = _http_get ) #NEWLINE# result = service . get_file_exists ( repository , '/path' , revision , base_commit_id ) #NEWLINE# self . assertTrue ( service . client . http_get . called ) #NEWLINE# self . assertEqual ( result , expected_found )