Add a new microversion for data model API
microversion 1.3 for list data model API Change-Id: Ibf8774a48c3d13ca9762bd5319f5e1ce2ed82b2f Closes-Bug: #1854121
This commit is contained in:
@@ -27,8 +27,9 @@ class TestRoot(base.FunctionalTest):
|
||||
|
||||
class TestV1Root(base.FunctionalTest):
|
||||
|
||||
def test_get_v1_root(self):
|
||||
data = self.get_json('/')
|
||||
def test_get_v1_root_all(self):
|
||||
data = self.get_json(
|
||||
'/', headers={'OpenStack-API-Version': 'infra-optim 1.3'})
|
||||
self.assertEqual('v1', data['id'])
|
||||
# Check fields are not empty
|
||||
for f in data.keys():
|
||||
@@ -43,3 +44,21 @@ class TestV1Root(base.FunctionalTest):
|
||||
|
||||
self.assertIn({'type': 'application/vnd.openstack.watcher.v1+json',
|
||||
'base': 'application/json'}, data['media_types'])
|
||||
|
||||
def test_get_v1_root_without_datamodel(self):
|
||||
data = self.get_json(
|
||||
'/', headers={'OpenStack-API-Version': 'infra-optim 1.2'})
|
||||
self.assertEqual('v1', data['id'])
|
||||
# Check fields are not empty
|
||||
for f in data.keys():
|
||||
self.assertNotIn(f, ['', []])
|
||||
# Check if all known resources are present and there are no extra ones.
|
||||
not_resources = ('id', 'links', 'media_types')
|
||||
actual_resources = tuple(set(data.keys()) - set(not_resources))
|
||||
expected_resources = ('audit_templates', 'audits', 'actions',
|
||||
'action_plans', 'scoring_engines',
|
||||
'services')
|
||||
self.assertEqual(sorted(expected_resources), sorted(actual_resources))
|
||||
|
||||
self.assertIn({'type': 'application/vnd.openstack.watcher.v1+json',
|
||||
'base': 'application/json'}, data['media_types'])
|
||||
|
||||
Reference in New Issue
Block a user