No need the redundant validation in manager level
Alone with the enabling of schema validation for V2 API, the property validation has been handled in controller level, property validation based on clean.py in manager level is no long needed for creating a project since schema validation is enabled for both V2 and V3. The patch removes the call from `clean.py` and remove the relevant testcases since we already have the testcases both in `test_validation.py` or `test_v2_validation.py`. Partially implements: bp schema-validation-extent Change-Id: I9d2ea60d496d83372109ca227ee2091850de0213
This commit is contained in:
parent
f26b31a014
commit
295cfde14c
|
@ -196,8 +196,7 @@ class Manager(manager.Manager):
|
|||
project['name'])
|
||||
|
||||
project.setdefault('enabled', True)
|
||||
project['enabled'] = clean.project_enabled(project['enabled'])
|
||||
project['name'] = clean.project_name(project['name'])
|
||||
project['name'] = project['name'].strip()
|
||||
project.setdefault('description', '')
|
||||
|
||||
# For regular projects, the controller will ensure we have a valid
|
||||
|
|
|
@ -302,28 +302,6 @@ class ResourceTests(object):
|
|||
project['id'],
|
||||
project)
|
||||
|
||||
def test_create_project_blank_name_fails(self):
|
||||
project = unit.new_project_ref(
|
||||
name='', domain_id=CONF.identity.default_domain_id)
|
||||
self.assertRaises(exception.ValidationError,
|
||||
self.resource_api.create_project,
|
||||
project['id'],
|
||||
project)
|
||||
|
||||
def test_create_project_invalid_name_fails(self):
|
||||
project = unit.new_project_ref(
|
||||
name=None, domain_id=CONF.identity.default_domain_id)
|
||||
self.assertRaises(exception.ValidationError,
|
||||
self.resource_api.create_project,
|
||||
project['id'],
|
||||
project)
|
||||
project = unit.new_project_ref(
|
||||
name=123, domain_id=CONF.identity.default_domain_id)
|
||||
self.assertRaises(exception.ValidationError,
|
||||
self.resource_api.create_project,
|
||||
project['id'],
|
||||
project)
|
||||
|
||||
def test_update_project_blank_name_fails(self):
|
||||
project = unit.new_project_ref(
|
||||
name='fake1', domain_id=CONF.identity.default_domain_id)
|
||||
|
@ -374,16 +352,6 @@ class ResourceTests(object):
|
|||
project['id'],
|
||||
project)
|
||||
|
||||
def test_create_project_invalid_enabled_type_string(self):
|
||||
project = unit.new_project_ref(
|
||||
domain_id=CONF.identity.default_domain_id,
|
||||
# invalid string value
|
||||
enabled="true")
|
||||
self.assertRaises(exception.ValidationError,
|
||||
self.resource_api.create_project,
|
||||
project['id'],
|
||||
project)
|
||||
|
||||
def test_create_project_invalid_domain_id(self):
|
||||
project = unit.new_project_ref(domain_id=uuid.uuid4().hex)
|
||||
self.assertRaises(exception.DomainNotFound,
|
||||
|
|
|
@ -300,21 +300,6 @@ class SqlIdentity(SqlTests,
|
|||
ref['name'] = ref['name'].upper()
|
||||
self.resource_api.create_project(ref['id'], ref)
|
||||
|
||||
def test_create_null_project_name(self):
|
||||
project = unit.new_project_ref(
|
||||
name=None, domain_id=CONF.identity.default_domain_id)
|
||||
self.assertRaises(exception.ValidationError,
|
||||
self.resource_api.create_project,
|
||||
project['id'],
|
||||
project)
|
||||
self.assertRaises(exception.ProjectNotFound,
|
||||
self.resource_api.get_project,
|
||||
project['id'])
|
||||
self.assertRaises(exception.ProjectNotFound,
|
||||
self.resource_api.get_project_by_name,
|
||||
project['name'],
|
||||
CONF.identity.default_domain_id)
|
||||
|
||||
def test_delete_project_with_user_association(self):
|
||||
user = unit.new_user_ref(domain_id=CONF.identity.default_domain_id)
|
||||
user = self.identity_api.create_user(user)
|
||||
|
|
Loading…
Reference in New Issue