コード例 #1
0
ファイル: test_sync.py プロジェクト: 4teamwork/ftw.contacts
    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)
コード例 #2
0
ファイル: test_sync.py プロジェクト: 4teamwork/ftw.contacts
 def test_default_mapper(self):
     mapper = get_ldap_attribute_mapper()
     self.assertEquals('uid', mapper.id())
     self.assertEquals('lastname', mapper.mapping()['sn'])