Use mail for the default LDAP email attribute name

test_user_mixed_case_attribute passes when not using a live LDAP backend.
The test fails when using a live LDAP backend because the standard LDAP
email attribute is 'mail', but the test is expecting the LDAP backend to
use 'email' as the attribute name.  The fix is to use 'mail' as the
attribute returned by the LDAP backend, and 'email' as the corresponding
property in the User object.
To test, run the test_ldap_livetest test e.g.

  python -m testtools.run keystone.tests.test_ldap_livetest

Closes-Bug: #1321822

Change-Id: I2100b5706852fdc7dfea2d4473ef6685c8a2f874
This commit is contained in:
Rich Megginson 2014-05-21 10:32:12 -06:00
parent 0fdc042313
commit ab429148c3
2 changed files with 3 additions and 3 deletions

View File

@ -511,7 +511,7 @@ FILE_OPTIONS = {
help='LDAP attribute mapped to user id.'),
cfg.StrOpt('user_name_attribute', default='sn',
help='LDAP attribute mapped to user name.'),
cfg.StrOpt('user_mail_attribute', default='email',
cfg.StrOpt('user_mail_attribute', default='mail',
help='LDAP attribute mapped to user email.'),
cfg.StrOpt('user_pass_attribute', default='userPassword',
help='LDAP attribute mapped to password.'),

View File

@ -1278,13 +1278,13 @@ class LDAPIdentity(BaseLDAPIdentity, tests.TestCase):
'cn=junk,dc=example,dc=com',
{
'sN': [uuid.uuid4().hex],
'eMaIl': [uuid.uuid4().hex]
'MaIl': [uuid.uuid4().hex]
}
)
user = self.identity_api.get_user('junk')
self.assertEqual(mock_ldap_get.return_value[1]['sN'][0],
user['name'])
self.assertEqual(mock_ldap_get.return_value[1]['eMaIl'][0],
self.assertEqual(mock_ldap_get.return_value[1]['MaIl'][0],
user['email'])
def test_parse_extra_attribute_mapping(self):