Merge "Remove v2.0 assignment schema"
This commit is contained in:
commit
489e4b1420
|
@ -12,21 +12,6 @@
|
|||
|
||||
from keystone.common.validation import parameter_types
|
||||
|
||||
# Schema for Identity v2 API
|
||||
|
||||
_role_properties_v2 = {
|
||||
'name': parameter_types.name,
|
||||
'id': parameter_types.id_string,
|
||||
'description': parameter_types.description
|
||||
}
|
||||
|
||||
role_create_v2 = {
|
||||
'type': 'object',
|
||||
'properties': _role_properties_v2,
|
||||
'required': ['name'],
|
||||
'additionalProperties': True
|
||||
}
|
||||
|
||||
# Schema for Identity v3 API
|
||||
|
||||
_role_properties = {
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
|
||||
import uuid
|
||||
|
||||
from keystone.assignment import schema as assignment_schema
|
||||
from keystone.catalog import schema as catalog_schema
|
||||
from keystone.common.validation import validators
|
||||
from keystone import exception
|
||||
|
@ -28,58 +27,6 @@ _VALID_ENABLED_FORMATS = [True, False]
|
|||
_INVALID_ENABLED_FORMATS = ['some string', 1, 0, 'True', 'False']
|
||||
|
||||
|
||||
class RoleValidationTestCase(unit.BaseTestCase):
|
||||
"""Test for V2 Roles API Validation."""
|
||||
|
||||
def setUp(self):
|
||||
super(RoleValidationTestCase, self).setUp()
|
||||
|
||||
schema_role_create = assignment_schema.role_create_v2
|
||||
self.create_validator = validators.SchemaValidator(schema_role_create)
|
||||
|
||||
def test_validate_role_create_succeeds(self):
|
||||
request = {
|
||||
'name': uuid.uuid4().hex
|
||||
}
|
||||
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,
|
||||
'asdf': uuid.uuid4().hex
|
||||
}
|
||||
self.create_validator.validate(request)
|
||||
|
||||
def test_validate_role_create_fails_with_invalid_params(self):
|
||||
request = {
|
||||
'bogus': uuid.uuid4().hex
|
||||
}
|
||||
self.assertRaises(exception.SchemaValidationError,
|
||||
self.create_validator.validate,
|
||||
request)
|
||||
|
||||
def test_validate_role_create_fails_with_no_params(self):
|
||||
request = {}
|
||||
self.assertRaises(exception.SchemaValidationError,
|
||||
self.create_validator.validate,
|
||||
request)
|
||||
|
||||
def test_validate_role_create_fails_with_invalid_name(self):
|
||||
"""Exception when validating a create request with invalid `name`."""
|
||||
for invalid_name in _INVALID_NAMES:
|
||||
request_to_validate = {'name': invalid_name}
|
||||
self.assertRaises(exception.SchemaValidationError,
|
||||
self.create_validator.validate,
|
||||
request_to_validate)
|
||||
|
||||
|
||||
class TenantValidationTestCase(unit.BaseTestCase):
|
||||
"""Test for v2 Tenant API Validation."""
|
||||
|
||||
|
|
Loading…
Reference in New Issue