Merge "Nits from Ic3ab7d60e4ac12b767fe70bef97b327545a86e74"

This commit is contained in:
Zuul 2017-12-23 16:52:51 +00:00 committed by Gerrit Code Review
commit ac8a3089e5
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/')