Merge "Fix add/remove SecurityGroup action json schemas"

This commit is contained in:
Zuul 2025-01-10 11:08:18 +00:00 committed by Gerrit Code Review
commit a459467899
2 changed files with 28 additions and 12 deletions

View File

@ -111,11 +111,19 @@ server_sg_index_query = {
add_security_group = {
'type': 'object',
'properties': {
'name': {
'type': 'string',
'minLength': 1,
},
'addSecurityGroup': {
'type': 'object',
'properties': {
'name': {
'type': 'string',
'minLength': 1,
},
},
'required': ['name'],
'additionalProperties': False
}
},
'required': ['addSecurityGroup'],
'additionalProperties': True,
}
@ -123,11 +131,19 @@ add_security_group = {
remove_security_group = {
'type': 'object',
'properties': {
'name': {
'type': 'string',
'minLength': 1,
},
'removeSecurityGroup': {
'type': 'object',
'properties': {
'name': {
'type': 'string',
'minLength': 1,
},
},
'required': ['name'],
'additionalProperties': False
}
},
'required': ['removeSecurityGroup'],
'additionalProperties': True,
}

View File

@ -728,14 +728,14 @@ class TestSecurityGroupsV21(test.TestCase):
body = dict(addSecurityGroup=None)
self.assertRaises(
webob.exc.HTTPBadRequest,
exception.ValidationError,
self.manager._addSecurityGroup, self.req, '1', body=body)
def test_associate_no_security_group_name(self):
body = dict(addSecurityGroup=dict())
self.assertRaises(
webob.exc.HTTPBadRequest,
exception.ValidationError,
self.manager._addSecurityGroup, self.req, '1', body=body)
def test_associate_security_group_name_with_whitespaces(self):
@ -846,14 +846,14 @@ class TestSecurityGroupsV21(test.TestCase):
def test_disassociate_without_body(self):
body = dict(removeSecurityGroup=None)
self.assertRaises(webob.exc.HTTPBadRequest,
self.assertRaises(exception.ValidationError,
self.manager._removeSecurityGroup, self.req,
'1', body=body)
def test_disassociate_no_security_group_name(self):
body = dict(removeSecurityGroup=dict())
self.assertRaises(webob.exc.HTTPBadRequest,
self.assertRaises(exception.ValidationError,
self.manager._removeSecurityGroup, self.req,
'1', body=body)