def test_example_with_a_mocked_call(self, json_mock): m = mock.mock_open(read_data='"content"') with mock.patch.object(builtins, 'open', m): sops.load_tree('path', 'json') json_mock.assert_called_with(m())
def test_yaml_loader_is_used_on_yaml_filetype(self): # XXX put some real yaml here. m = mock.mock_open(read_data='"content"') with mock.patch.object(builtins, 'open', m): assert sops.load_tree('path', 'yaml') == "content"