Fix v2 role create schema validation
Currently, creating a new role using the v2 api no longer allows spaces in the role description. This patch set changes the schema type, and also fixes a bug in the v2 validation test where the validation is performed against the v3 schema instead of v2. Co-Authored-By: Gage Hugo <gagehugo@gmail.com> Change-Id: I858005c7805ba87f506933d49715cc3ce0d539e1 Closes-Bug: #1667367
This commit is contained in:
parent
1d4c72cd6f
commit
eb535ca476
|
@ -17,7 +17,7 @@ from keystone.common.validation import parameter_types
|
|||
_role_properties_v2 = {
|
||||
'name': parameter_types.name,
|
||||
'id': parameter_types.id_string,
|
||||
'description': parameter_types.id_string
|
||||
'description': parameter_types.description
|
||||
}
|
||||
|
||||
role_create_v2 = {
|
||||
|
|
|
@ -34,7 +34,7 @@ class RoleValidationTestCase(unit.BaseTestCase):
|
|||
def setUp(self):
|
||||
super(RoleValidationTestCase, self).setUp()
|
||||
|
||||
schema_role_create = assignment_schema.role_create
|
||||
schema_role_create = assignment_schema.role_create_v2
|
||||
self.create_validator = validators.SchemaValidator(schema_role_create)
|
||||
|
||||
def test_validate_role_create_succeeds(self):
|
||||
|
@ -43,6 +43,13 @@ class RoleValidationTestCase(unit.BaseTestCase):
|
|||
}
|
||||
self.create_validator.validate(request)
|
||||
|
||||
def test_validate_role_create_succeeds_with_spaces_in_description(self):
|
||||
request = {
|
||||
'name': uuid.uuid4().hex,
|
||||
'description': 'Description with spaces'
|
||||
}
|
||||
self.create_validator.validate(request)
|
||||
|
||||
def test_validate_role_create_succeeds_with_extra_params(self):
|
||||
request = {
|
||||
'name': uuid.uuid4().hex,
|
||||
|
|
Loading…
Reference in New Issue