#NEWLINE# def test_pickme_conflict_master_integration( self ) : #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# german_req = { #NEWLINE# #INDENT# 'id' : 1 , #NEWLINE# 'tags' : 'git-ok' , #NEWLINE# 'title' : 'German' , #NEWLINE# 'repo' : '.' , #NEWLINE# 'branch' : 'change_german' , #NEWLINE# #UNINDENT# } #NEWLINE# GitCommand ( 'checkout' , 'master' , 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# class NoRemoteBranchContextManager ( object ) : #NEWLINE# #INDENT# def __init__( self , branch , path ) : #NEWLINE# #INDENT# self . branch = branch #NEWLINE# self . path = path #NEWLINE# #UNINDENT# def __enter__( self ) : #NEWLINE# #INDENT# GitCommand ( 'checkout' , '-b' , self . branch , cwd = self . path ) . run ( ) #NEWLINE# #UNINDENT# def __exit__( self , * args ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# with nested ( mock . patch ( 'pushmanager.core.git.GitQueue._update_request' ) , mock . patch ( 'pushmanager.core.git.git_branch_context_manager' , NoRemoteBranchContextManager ) , mock . patch ( 'pushmanager.core.git.GitQueue.create_or_update_local_repo' ) , mock . patch . dict ( Settings , test_settings , clear = True ) ) as ( update_req , _ , _ , _ ) : #NEWLINE# #INDENT# ( conflict , _ ) = pushmanager . core . git . GitQueue . _test_pickme_conflict_master ( 0 , german_req , 'test_pcm' , repo_path , pushmanager_url , False ) #NEWLINE# T . assert_equal ( conflict , True ) #NEWLINE# updated_request = update_req . call_args #NEWLINE# T . assert_equal ( ( 'conflict-master' in updated_request [ 0 ] [ 1 ] [ 'tags' ] ) , True ) #NEWLINE# T . assert_equal ( ( 'master' in updated_request [ 0 ] [ 1 ] [ 'conflicts' ] ) , True )