Beispiel #1
0
 def test_handle_ldap3_entry(self):
     e = {'dn': u'uni=anp8,ou=People,o=Columbia University,c=US',
          'attributes': {
              u'telephoneNumber': [u'+1 212 854 1813'],
              u'departmentNumber': [u'1612303'],
              u'cuMiddlename': [u'N.'],
              u'cn': [u'Anders N. Pearson'],
              u'title': [u'Manager, Web Infrastructure'],
              u'objectClass': [u'person', u'organizationalPerson',
                               u'inetOrgPerson', u'cuPerson',
                               u'cuRestricted', u'eduPerson'],
              u'campusphone': [u'MS 4-1813'],
              u'sn': [u'Pearson'],
              u'uni': u'anp8',
              u'mail': [u'*****@*****.**'],
              u'postalAddress': [u'somewhere'],
              u'givenName': [u'Anders'],
              u'ou': [u'CU Information Technology']},
          'raw_attributes': {
              u'telephoneNumber': ['+1 212 854 1813'],
              u'departmentNumber': ['1612303'],
              u'cuMiddlename': ['N.'],
              u'cn': ['Anders N. Pearson'],
              u'title': ['Manager, Web Infrastructure'],
              u'objectClass': ['person', 'organizationalPerson',
                               'inetOrgPerson', 'cuPerson',
                               'cuRestricted', 'eduPerson'],
              u'campusphone': ['MS 4-1813'],
              u'sn': ['Pearson'], u'uni': ['anp8'],
              u'mail': ['*****@*****.**'],
              u'postalAddress': ['somewhere'],
              u'givenName': ['Anders'],
              u'ou': ['CU Information Technology']},
          'type': 'searchResEntry'}
     r = _handle_ldap3_entry(e)
     self.assertEqual(r['uni'], 'anp8')
     self.assertEqual(r['sn'], 'Pearson')
     self.assertEqual(r['firstname'], 'Anders')
     self.assertEqual(r['lastname'], 'Pearson')
Beispiel #2
0
 def test_handle_ldap3_entry_empty(self):
     e = dict(attributes=dict())
     r = _handle_ldap3_entry(e)
     self.assertEqual(r, dict())