#NEWLINE# def _pickme_conflict_pickme_integration( self , request_state ) : #NEWLINE# #INDENT# test_settings = copy . deepcopy ( Settings ) #NEWLINE# repo_path = tempfile . mkdtemp ( prefix = 'pushmanager' ) #NEWLINE# self . temp_git_dirs . append ( repo_path ) #NEWLINE# test_settings [ 'git' ] [ 'local_repo_path' ] = repo_path #NEWLINE# GitCommand ( 'init' , test_settings [ 'git' ] [ 'local_repo_path' ] , cwd = repo_path ) . run ( ) #NEWLINE# GitCommand ( 'config' , 'user.email' , 'test@pushmanager' , cwd = repo_path ) . run ( ) #NEWLINE# GitCommand ( 'config' , 'user.name' , 'pushmanager tester' , cwd = repo_path ) . run ( ) #NEWLINE# with open ( os . path . join ( repo_path , 'code.py' ) , 'w' ) as f : #NEWLINE# #INDENT# f . write ( '#!/usr/bin/env python\n\nprint("Hello World!")\nPrint("Goodbye!")\n' ) #NEWLINE# #UNINDENT# GitCommand ( 'add' , repo_path , cwd = repo_path ) . run ( ) #NEWLINE# GitCommand ( 'commit' , '-a' , '-m' , 'Master Commit' , cwd = repo_path ) . run ( ) #NEWLINE# GitCommand ( 'checkout' , '-b' , 'change_german' , cwd = repo_path ) . run ( ) #NEWLINE# with open ( os . path . join ( repo_path , 'code.py' ) , 'w' ) as f : #NEWLINE# #INDENT# f . write ( '#!/usr/bin/env python\n\nprint("Hallo Welt!")\nPrint("Goodbye!")\n' ) #NEWLINE# #UNINDENT# GitCommand ( 'commit' , '-a' , '-m' , 'verpflichten' , cwd = repo_path ) . run ( ) #NEWLINE# GitCommand ( 'checkout' , 'master' , cwd = repo_path ) . run ( ) #NEWLINE# german_req = { #NEWLINE# #INDENT# 'id' : 1 , #NEWLINE# 'state' : request_state , #NEWLINE# 'user' : 'test' , #NEWLINE# 'tags' : 'git-ok,no-conflicts' , #NEWLINE# 'title' : 'German' , #NEWLINE# 'repo' : '.' , #NEWLINE# 'branch' : 'change_german' , #NEWLINE# #UNINDENT# } #NEWLINE# GitCommand ( 'checkout' , '-b' , 'change_welsh' , cwd = repo_path ) . run ( ) #NEWLINE# with open ( os . path . join ( repo_path , 'code.py' ) , 'w' ) as f : #NEWLINE# #INDENT# f . write ( '#!/usr/bin/env python\n\nprint("Helo Byd!")\nPrint("Goodbye!")\n' ) #NEWLINE# #UNINDENT# GitCommand ( 'commit' , '-a' , '-m' , 'ymrwymo' , cwd = repo_path ) . run ( ) #NEWLINE# GitCommand ( 'checkout' , 'master' , cwd = repo_path ) . run ( ) #NEWLINE# welsh_req = { #NEWLINE# #INDENT# 'id' : 2 , #NEWLINE# 'state' : conflict , #NEWLINE# 'user' : 'test' , #NEWLINE# 'user' : 'test' , #NEWLINE# 'tags' : 'git-ok,no-conflicts' , #NEWLINE# 'title' : 'Welsh' , #NEWLINE# 'repo' : '.' , #NEWLINE# 'branch' : 'change_welsh' , #NEWLINE# #UNINDENT# } #NEWLINE# GitCommand ( 'checkout' , '-b' , 'test_pcp' , cwd = repo_path ) . run ( ) #NEWLINE# with mock . patch ( 'pushmanager.core.git.GitQueue.create_or_update_local_repo' ) as update_repo : #NEWLINE# #INDENT# pushmanager . core . git . GitQueue . git_merge_pickme ( 0 , german_req , repo_path ) #NEWLINE# update_repo . assert_called_with ( 0 , '.' , 'change_german' , checkout = False ) #NEWLINE# #UNINDENT# with nested ( mock . patch ( 'pushmanager.core.git.GitQueue._get_push_for_request' ) , mock . patch ( 'pushmanager.core.git.GitQueue._get_request_ids_in_push' ) , mock . patch ( 'pushmanager.core.git.GitQueue._get_request' ) , mock . patch ( 'pushmanager.core.git.GitQueue._get_branch_sha_from_repo' ) , mock . patch ( 'pushmanager.core.git.GitQueue._sha_exists_in_master' ) , mock . patch ( 'pushmanager.core.git.GitQueue.create_or_update_local_repo' ) , mock . patch ( 'pushmanager.core.git.GitQueue._update_request' ) , mock . patch . dict ( Settings , test_settings , clear = True ) ) as ( p_for_r , r_in_p , get_req , get_sha , sha_exists , _ , update_req , _ ) : #NEWLINE# #INDENT# p_for_r . return_value = { #NEWLINE# #INDENT# 'push' : 1 , #NEWLINE# #UNINDENT# } #NEWLINE# r_in_p . return_value = [ 1 , 2 ] #NEWLINE# get_req . return_value = welsh_req #NEWLINE# get_sha . return_value = ( '0' * 40 ) #NEWLINE# sha_exists . return_value = False #NEWLINE# update_req . return_value = german_req #NEWLINE# ( conflict , _ ) = pushmanager . core . git . GitQueue . _test_pickme_conflict_pickme ( 0 , german_req , 'test_pcp' , repo_path , pushmanager_url , False ) #NEWLINE# return ( conflict , update_req . call_args )