#NEWLINE# def test_read_service_namespace_config_exists( self ) : #NEWLINE# #INDENT# name = 'eman' #NEWLINE# namespace = 'ecapseman' #NEWLINE# soa_dir = 'rid_aos' #NEWLINE# mode = 'http' #NEWLINE# fake_healthcheck_mode = 'http' #NEWLINE# fake_uri = 'energy' #NEWLINE# fake_timeout = ( - 10103 ) #NEWLINE# fake_port = 777 #NEWLINE# fake_retries = 9001 #NEWLINE# fake_discover = 'myhabitat' #NEWLINE# fake_advertise = [ 'red' , 'blue' ] #NEWLINE# fake_info = { #NEWLINE# #INDENT# 'healthcheck_mode' : fake_healthcheck_mode , #NEWLINE# 'healthcheck_uri' : fake_uri , #NEWLINE# 'healthcheck_timeout_s' : fake_timeout , #NEWLINE# 'proxy_port' : fake_port , #NEWLINE# 'timeout_connect_ms' : 192 , #NEWLINE# 'timeout_server_ms' : 291 , #NEWLINE# 'timeout_client_ms' : 912 , #NEWLINE# 'updown_timeout_s' : 293 , #NEWLINE# 'retries' : fake_retries , #NEWLINE# 'mode' : mode , #NEWLINE# 'routes' : [ { #NEWLINE# #INDENT# 'source' : 'oregon' , #NEWLINE# 'destinations' : [ 'indiana' ] , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'source' : 'florida' , #NEWLINE# 'destinations' : [ 'miami' , 'beach' ] , #NEWLINE# #UNINDENT# } ] , #NEWLINE# 'discover' : fake_discover , #NEWLINE# 'advertise' : fake_advertise , #NEWLINE# 'extra_advertise' : { #NEWLINE# #INDENT# 'alpha' : [ 'beta' ] , #NEWLINE# 'gamma' : [ 'delta' , 'epsilon' ] , #NEWLINE# #UNINDENT# } , #NEWLINE# 'extra_healthcheck_headers' : { #NEWLINE# #INDENT# 'Host' : 'example.com' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# fake_config = { #NEWLINE# #INDENT# 'smartstack' : { #NEWLINE# #INDENT# namespace : fake_info , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# expected = { #NEWLINE# #INDENT# 'healthcheck_mode' : fake_healthcheck_mode , #NEWLINE# 'healthcheck_uri' : fake_uri , #NEWLINE# 'healthcheck_timeout_s' : fake_timeout , #NEWLINE# 'proxy_port' : fake_port , #NEWLINE# 'timeout_connect_ms' : 192 , #NEWLINE# 'timeout_server_ms' : 291 , #NEWLINE# 'timeout_client_ms' : 912 , #NEWLINE# 'updown_timeout_s' : 293 , #NEWLINE# 'retries' : fake_retries , #NEWLINE# 'mode' : mode , #NEWLINE# 'routes' : [ ( 'oregon' , 'indiana' ) , ( 'florida' , 'miami' ) , ( 'florida' , 'beach' ) ] , #NEWLINE# 'discover' : fake_discover , #NEWLINE# 'advertise' : fake_advertise , #NEWLINE# 'extra_advertise' : [ ( 'alpha' , 'beta' ) , ( 'gamma' , 'delta' ) , ( 'gamma' , 'epsilon' ) ] , #NEWLINE# 'extra_healthcheck_headers' : { #NEWLINE# #INDENT# 'Host' : 'example.com' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# with mock . patch ( 'service_configuration_lib.read_service_configuration' , autospec = True , return_value = fake_config ) as read_service_configuration_patch : #NEWLINE# #INDENT# actual = marathon_tools . load_service_namespace_config ( name , namespace , soa_dir ) #NEWLINE# read_service_configuration_patch . assert_called_once_with ( name , soa_dir ) #NEWLINE# assert ( sorted ( actual ) == sorted ( expected ) )