Test case for bad type user in assertion

This patch adds a test case to validate wrong
type user in local of mapping assertion.

Change-Id: I15e56a279fff71445bcb23355bd4815d1f5fe0a9
This commit is contained in:
Vishakha Agarwal 2019-01-31 15:35:00 +05:30
parent 8fe84eecf7
commit 0168615920
2 changed files with 36 additions and 0 deletions

View File

@ -676,6 +676,12 @@ class MappingRuleEngineTests(unit.BaseTestCase):
mapping_utils.validate_mapping_structure,
mapping)
def test_mapping_validation_with_bad_local_type_user_in_assertion(self):
mapping = mapping_fixtures.MAPPING_BAD_LOCAL_TYPE_USER_IN_ASSERTION
self.assertRaises(exception.ValidationError,
mapping_utils.validate_mapping_structure,
mapping)
def test_mapping_validation_no_local(self):
mapping = mapping_fixtures.MAPPING_MISSING_LOCAL
self.assertRaises(exception.ValidationError,

View File

@ -1406,6 +1406,36 @@ MAPPING_BAD_LOCAL_SETUP = {
]
}
MAPPING_BAD_LOCAL_TYPE_USER_IN_ASSERTION = {
"rules": [
{
"local": [
{
"user": {
"name": "{0}",
"groups": "{1}"
}
}
],
"remote": [
{
"type": "openstack_user"
},
{
"type": "openstack_groups"
},
{
"type": "openstack_roles",
"any_one_of": [
"Admin"
]
}
]
},
]
}
MAPPING_GROUPS_WITH_EMAIL = {
"rules": [
{