def test_get_config_returns_dict_of_config_file(self): with mock.patch("__builtin__.open", mock.mock_open(read_data="{}")) as mock_open: ret = get_config("non-exist") assert mock_open.called self.assertIsInstance(ret, dict)
def test_get_config_returns_empty_dict_on_invalid_configfile(self): with mock.patch("json.loads", mock.Mock(side_effect=ValueError)): ret = get_config("non-exist") self.assertEqual(ret, {})