Nits from Ic3ab7d60e4ac12b767fe70bef97b327545a86e74

A missing test case and a missing space in an error message are adde
as a follow up of Ic3ab7d60e4ac12b767fe70bef97b327545a86e74

Change-Id: I9d348dc5ce74590a4bed7b7e746333e3df3848c7
This commit is contained in:
Balazs Gibizer 2017-11-28 15:55:45 +01:00
parent b60a599b5f
commit 579ae3880c
2 changed files with 11 additions and 1 deletions

View File

@ -20,7 +20,7 @@ from oslo_serialization import jsonutils
def _resolve_ref(ref, base_path):
file_path, _, json_path = ref.partition('#')
if json_path:
raise NotImplementedError('JSON refs with JSON path after the "#" is'
raise NotImplementedError('JSON refs with JSON path after the "#" is '
'not yet supported')
path = os.path.join(base_path, file_path)

View File

@ -132,3 +132,13 @@ class TestJsonRef(test.NoDBTestCase):
'c': 13}}},
actual)
mock_open.assert_called_once_with('some/base/path/another.json', 'r+b')
def test_ref_with_json_path_not_supported(self):
self.assertRaises(
NotImplementedError, json_ref.resolve_refs,
{'foo': 1,
'bar': {'$ref': 'another.json#/key-in-another',
'boo': {'b': 3,
'c': 13}}},
'some/base/path/')