def test_custom_mapper(self): class MyLDAPAttributeMapper(object): implements(ILDAPAttributeMapper) def mapping(self): return {'sAMAccountName': 'userid'} def id(self): return 'sAMAccountName' my_mapper = MyLDAPAttributeMapper() provideUtility(my_mapper) mapper = get_ldap_attribute_mapper() self.assertEquals('sAMAccountName', mapper.id()) self.assertEquals('userid', mapper.mapping()['sAMAccountName']) # cleanup getGlobalSiteManager().unregisterUtility(my_mapper, ILDAPAttributeMapper)
def test_default_mapper(self): mapper = get_ldap_attribute_mapper() self.assertEquals('uid', mapper.id()) self.assertEquals('lastname', mapper.mapping()['sn'])