diff --git a/keystone/tests/test_backend_ldap.py b/keystone/tests/test_backend_ldap.py index 4e17c8693..6085dc4d8 100644 --- a/keystone/tests/test_backend_ldap.py +++ b/keystone/tests/test_backend_ldap.py @@ -1000,6 +1000,29 @@ class LDAPIdentity(BaseLDAPIdentity, tests.TestCase): dn, attrs = self.identity_api.driver.user._ldap_get(user['id']) self.assertTrue(user['name'] in attrs['description']) + def test_user_extra_attribute_mapping_description(self): + # Given a mapping like description:description, the description isn't + # returned. + + self.config_fixture.config( + group='ldap', + user_additional_attribute_mapping=['description:description']) + self.load_backends() + user = { + 'id': uuid.uuid4().hex, + 'name': uuid.uuid4().hex, + 'description': uuid.uuid4().hex, + 'password': uuid.uuid4().hex, + 'domain_id': CONF.identity.default_domain_id + } + self.identity_api.create_user(user['id'], user) + res = self.identity_api.driver.user.get_all() + + new_user = [u for u in res if u['id'] == user['id']][0] + # TODO(blk-u): The description should be returned, see bug #1293698. + self.assertThat(new_user, + matchers.Not(matchers.Contains('description'))) + @mock.patch.object(common_ldap_core.BaseLdap, '_ldap_get') def test_user_mixed_case_attribute(self, mock_ldap_get): # Mock the search results to return attribute names