Merge "Enhance tests for user extra attribute mapping"
This commit is contained in:
commit
4907779e1c
@ -1000,6 +1000,29 @@ class LDAPIdentity(BaseLDAPIdentity, tests.TestCase):
|
|||||||
dn, attrs = self.identity_api.driver.user._ldap_get(user['id'])
|
dn, attrs = self.identity_api.driver.user._ldap_get(user['id'])
|
||||||
self.assertTrue(user['name'] in attrs['description'])
|
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')
|
@mock.patch.object(common_ldap_core.BaseLdap, '_ldap_get')
|
||||||
def test_user_mixed_case_attribute(self, mock_ldap_get):
|
def test_user_mixed_case_attribute(self, mock_ldap_get):
|
||||||
# Mock the search results to return attribute names
|
# Mock the search results to return attribute names
|
||||||
|
Loading…
Reference in New Issue
Block a user