#NEWLINE# @ mock . patch ( 'paasta_tools.cli.cmds.local_run.socket.getfqdn' , autospec = True ) #NEWLINE# @ mock . patch ( 'paasta_tools.cli.cmds.local_run.run_docker_container' , autospec = True ) #NEWLINE# @ mock . patch ( 'paasta_tools.cli.cmds.local_run.load_system_paasta_config' , autospec = True ) #NEWLINE# @ mock . patch ( 'paasta_tools.cli.cmds.local_run.get_instance_config' , autospec = True ) #NEWLINE# @ mock . patch ( 'paasta_tools.cli.cmds.local_run.validate_service_instance' , autospec = True ) #NEWLINE# def test_configure_and_run_command_uses_cmd_from_config( mock_validate_service_instance , mock_get_instance_config , mock_load_system_paasta_config , mock_run_docker_container , mock_socket_getfqdn ) : #NEWLINE# #INDENT# mock_validate_service_instance . return_value = 'marathon' #NEWLINE# mock_load_system_paasta_config . return_value = SystemPaastaConfig ( { #NEWLINE# #INDENT# 'cluster' : 'fake_cluster' , #NEWLINE# 'volumes' : [ ] , #NEWLINE# #UNINDENT# } , '/fake_dir/' ) #NEWLINE# mock_docker_client = mock . MagicMock ( spec_set = docker . Client ) #NEWLINE# mock_get_instance_config . return_value . get_cmd . return_value = 'fake_command' #NEWLINE# mock_socket_getfqdn . return_value = 'fake_hostname' #NEWLINE# fake_service = 'fake_service' #NEWLINE# docker_hash = ( '8' * 40 ) #NEWLINE# args = mock . MagicMock ( ) #NEWLINE# args . cmd = '' #NEWLINE# args . service = fake_service #NEWLINE# args . instance = 'fake_instance' #NEWLINE# args . healthcheck = False #NEWLINE# args . healthcheck_only = False #NEWLINE# args . interactive = False #NEWLINE# assert ( configure_and_run_docker_container ( docker_client = mock_docker_client , docker_hash = docker_hash , service = fake_service , instance = 'fake_instance' , cluster = 'fake_cluster' , args = args ) is None ) #NEWLINE# mock_run_docker_container . assert_called_once_with ( docker_client = mock_docker_client , service = fake_service , instance = args . instance , docker_hash = docker_hash , volumes = [ ] , interactive = args . interactive , command = shlex . split ( mock_get_instance_config . return_value . get_cmd . return_value ) , hostname = mock_socket_getfqdn . return_value , healthcheck = args . healthcheck , healthcheck_only = args . healthcheck_only , instance_config = mock_get_instance_config . return_value , soa_dir = args . yelpsoa_config_root )