#NEWLINE# def test_create_complete_config_desired_state_stop( self ) : #NEWLINE# #INDENT# fake_owner = 'test@test.com' #NEWLINE# fake_chronos_job_config = chronos_tools . ChronosJobConfig ( service = load_chronos_job_config_patch . fake_service , cluster = '' , instance = self . fake_job_name , config_dict = self . fake_config_dict , branch_dict = { #NEWLINE# #INDENT# 'desired_state' : 'stop' , #NEWLINE# 'docker_image' : 'fake_image' , #NEWLINE# #UNINDENT# } ) #NEWLINE# fake_config_hash = 'fake_config_hash' #NEWLINE# with contextlib . nested ( mock . patch ( 'paasta_tools.chronos_tools.load_system_paasta_config' , autospec = True ) , mock . patch ( 'paasta_tools.chronos_tools.load_chronos_job_config' , autospec = True , return_value = fake_chronos_job_config ) , mock . patch ( 'paasta_tools.monitoring_tools.get_team' , return_value = fake_owner ) , mock . patch ( 'paasta_tools.chronos_tools.get_config_hash' , return_value = fake_config_hash ) ) as ( load_system_paasta_config_patch , load_chronos_job_config_patch , mock_get_team , mock_fake_config_hash ) : #NEWLINE# #INDENT# load_system_paasta_config_patch . return_value . get_volumes = mock . Mock ( return_value = [ ] ) #NEWLINE# load_system_paasta_config_patch . return_value . get_docker_registry = mock . Mock ( return_value = 'fake_registry' ) #NEWLINE# load_system_paasta_config_patch . return_value . get_dockercfg_location = mock . Mock ( return_value = 'file:///root/.dockercfg' ) #NEWLINE# actual = chronos_tools . create_complete_config ( 'fake_service' , 'fake_job' ) #NEWLINE# expected = { #NEWLINE# #INDENT# 'arguments' : None , #NEWLINE# 'description' : fake_config_hash , #NEWLINE# 'constraints' : [ [ 'pool' , 'EQUALS' , 'default' ] ] , #NEWLINE# 'schedule' : 'R/2015-03-25T19:36:35Z/PT5M' , #NEWLINE# 'async' : False , #NEWLINE# 'cpus' : 5.5 , #NEWLINE# 'scheduleTimeZone' : 'Zulu' , #NEWLINE# 'environmentVariables' : mock . ANY , #NEWLINE# 'retries' : 5 , #NEWLINE# 'disabled' : True , #NEWLINE# 'name' : 'fake_service fake_job' , #NEWLINE# 'command' : '/bin/sleep 40' , #NEWLINE# 'epsilon' : 'PT30M' , #NEWLINE# 'container' : { #NEWLINE# #INDENT# 'network' : 'BRIDGE' , #NEWLINE# 'volumes' : [ ] , #NEWLINE# 'image' : 'fake_registry/fake_image' , #NEWLINE# 'type' : 'DOCKER' , #NEWLINE# 'parameters' : [ { #NEWLINE# #INDENT# 'key' : 'memory-swap' , #NEWLINE# 'value' : '1025m' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } , #NEWLINE# 'uris' : [ 'file:///root/.dockercfg' ] , #NEWLINE# 'mem' : 1024.4 , #NEWLINE# 'disk' : 1234.5 , #NEWLINE# 'owner' : fake_owner , #NEWLINE# 'shell' : True , #NEWLINE# #UNINDENT# } #NEWLINE# assert ( actual == expected )