#NEWLINE# def test_get_healthcheck_for_instance_http( self ) : #NEWLINE# #INDENT# fake_service = 'fake_service' #NEWLINE# fake_namespace = 'fake_namespace' #NEWLINE# fake_hostname = 'fake_hostname' #NEWLINE# fake_random_port = 666 #NEWLINE# fake_path = '/fake_path' #NEWLINE# fake_marathon_service_config = marathon_tools . MarathonServiceConfig ( service = fake_service , cluster = 'fake_cluster' , instance = fake_random_port , config_dict = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , branch_dict = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# fake_service_namespace_config = marathon_tools . ServiceNamespaceConfig ( { #NEWLINE# #INDENT# 'mode' : 'http' , #NEWLINE# 'healthcheck_uri' : fake_path , #NEWLINE# #UNINDENT# } ) #NEWLINE# with contextlib . nested ( mock . patch ( 'paasta_tools.marathon_tools.load_marathon_service_config' , autospec = True , return_value = fake_marathon_service_config ) , mock . patch ( 'paasta_tools.marathon_tools.load_service_namespace_config' , autospec = True , return_value = fake_service_namespace_config ) , mock . patch ( 'socket.getfqdn' , autospec = True , return_value = fake_hostname ) ) as ( read_config_patch , load_service_namespace_config_patch , hostname_patch ) : #NEWLINE# #INDENT# expected = ( 'http' , ( 'http://%s:%d%s' % ( fake_hostname , fake_random_port , fake_path ) ) ) #NEWLINE# actual = marathon_tools . get_healthcheck_for_instance ( fake_service , fake_namespace , fake_marathon_service_config , fake_random_port ) #NEWLINE# assert ( expected == actual )