summaryrefslogtreecommitdiff
path: root/keystone/tests/unit/contrib/federation/test_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'keystone/tests/unit/contrib/federation/test_utils.py')
-rw-r--r--keystone/tests/unit/contrib/federation/test_utils.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/keystone/tests/unit/contrib/federation/test_utils.py b/keystone/tests/unit/contrib/federation/test_utils.py
index f9153cb09..4d9f98f2d 100644
--- a/keystone/tests/unit/contrib/federation/test_utils.py
+++ b/keystone/tests/unit/contrib/federation/test_utils.py
@@ -764,6 +764,24 @@ class MappingRuleEngineTests(unit.BaseTestCase):
self.assertEqual('ALL USERS',
mapped_properties['group_names'][0]['name'])
+ def test_rule_engine_groups_mapping_only_one_numerical_group(self):
+ """Test mapping engine when groups is explicitly set.
+
+ If the groups list has only one group,
+ test if the transformation is done correctly
+
+ """
+ mapping = mapping_fixtures.MAPPING_GROUPS_WITH_EMAIL
+ assertion = mapping_fixtures.GROUPS_ASSERTION_ONLY_ONE_NUMERICAL_GROUP
+ rp = mapping_utils.RuleProcessor(FAKE_MAPPING_ID, mapping['rules'])
+ mapped_properties = rp.process(assertion)
+ self.assertIsNotNone(mapped_properties)
+ self.assertEqual('jsmith', mapped_properties['user']['name'])
+ self.assertEqual('jill@example.com',
+ mapped_properties['user']['email'])
+ self.assertEqual('1234',
+ mapped_properties['group_names'][0]['name'])
+
def test_rule_engine_group_ids_mapping_whitelist(self):
"""Test mapping engine when group_ids is explicitly set.