Fix DEFAULT_SCHEMA to validate host_aggreates
Audit scope JSON schema should restrict key of host_aggregates to "id" or "name", but that is not working now. This patch fixes DEFAULT_SCHEMA to validate host_aggregates. Change-Id: Iea42da41d61435780e247736599a56c026f47914 Closes-Bug: #1714448
This commit is contained in:
@@ -511,7 +511,7 @@ class TestPost(FunctionalTestWithSetup):
|
||||
response.json['created_at']).replace(tzinfo=None)
|
||||
self.assertEqual(test_time, return_created_at)
|
||||
|
||||
def test_create_audit_template_vlidation_with_aggregates(self):
|
||||
def test_create_audit_template_validation_with_aggregates(self):
|
||||
scope = [{'host_aggregates': [{'id': '*'}]},
|
||||
{'availability_zones': [{'name': 'AZ1'},
|
||||
{'name': 'AZ2'}]},
|
||||
@@ -532,6 +532,14 @@ class TestPost(FunctionalTestWithSetup):
|
||||
"be included and excluded together"):
|
||||
self.post_json('/audit_templates', audit_template_dict)
|
||||
|
||||
scope = [{'host_aggregates': [{'id1': '*'}]}]
|
||||
audit_template_dict = post_get_test_audit_template(
|
||||
goal=self.fake_goal1.uuid,
|
||||
strategy=self.fake_strategy1.uuid, scope=scope)
|
||||
response = self.post_json('/audit_templates',
|
||||
audit_template_dict, expect_errors=True)
|
||||
self.assertEqual(500, response.status_int)
|
||||
|
||||
def test_create_audit_template_does_autogenerate_id(self):
|
||||
audit_template_dict = post_get_test_audit_template(
|
||||
goal=self.fake_goal1.uuid, strategy=None)
|
||||
|
||||
Reference in New Issue
Block a user