#NEWLINE# @ mock . patch ( 'paasta_tools.cli.cmds.metastatus.load_system_paasta_config' , autospec = True ) #NEWLINE# @ mock . patch ( 'sys.stdout' , new_callable = StringIO ) #NEWLINE# def test_report_cluster_status( mock_stdout , mock_load_system_paasta_config ) : #NEWLINE# #INDENT# cluster = 'fake_cluster' #NEWLINE# mock_load_system_paasta_config . return_value = SystemPaastaConfig ( { #NEWLINE# #INDENT# 'dashboard_links' : { #NEWLINE# #INDENT# 'fake_cluster' : { #NEWLINE# #INDENT# 'URL' : 'http://paasta-fake_cluster.yelp:5050' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , 'fake_directory' ) #NEWLINE# thing_to_patch = 'paasta_tools.cli.cmds.metastatus.execute_paasta_metastatus_on_remote_master' #NEWLINE# with mock . patch ( thing_to_patch ) as mock_execute_paasta_metastatus_on_remote_master : #NEWLINE# #INDENT# mock_execute_paasta_metastatus_on_remote_master . return_value = 'mock_status' #NEWLINE# metastatus . print_cluster_status ( cluster ) #NEWLINE# mock_execute_paasta_metastatus_on_remote_master . assert_called_once_with ( cluster , False ) #NEWLINE# actual = mock_stdout . getvalue ( ) #NEWLINE# assert ( ( 'Cluster: %s' % cluster ) in actual ) #NEWLINE# assert ( 'mock_status' in actual )