#NEWLINE# def test_load_marathon_config( self ) : #NEWLINE# #INDENT# expected = { #NEWLINE# #INDENT# 'foo' : 'bar' , #NEWLINE# #UNINDENT# } #NEWLINE# file_mock = mock . MagicMock ( spec = file ) #NEWLINE# with contextlib . nested ( mock . patch ( 'paasta_tools.marathon_tools.open' , create = True , return_value = expected ) , mock . patch ( 'json.load' , autospec = True , return_value = expected ) ) as ( open_file_patch , json_patch ) : #NEWLINE# #INDENT# assert ( marathon_tools . load_marathon_config ( ) == expected ) #NEWLINE# open_file_patch . assert_called_once_with ( '/etc/paasta/marathon.json' ) #NEWLINE# json_patch . assert_called_once_with ( file_mock . __enter__ ( ) )