Convert remaining test code to LDAPEntry API.

This commit is contained in:
Jan Cholasta 2013-10-31 16:55:23 +00:00 committed by Petr Viktorin
parent 97c1c95f20
commit 9d863e9a96
2 changed files with 5 additions and 5 deletions

View File

@ -61,7 +61,7 @@ class test_ldap(object):
""" """
self.conn = ldap2(shared_instance=False, ldap_uri=self.ldapuri) self.conn = ldap2(shared_instance=False, ldap_uri=self.ldapuri)
self.conn.connect() self.conn.connect()
(dn, entry_attrs) = self.conn.get_entry(self.dn, ['usercertificate']) entry_attrs = self.conn.get_entry(self.dn, ['usercertificate'])
cert = entry_attrs.get('usercertificate') cert = entry_attrs.get('usercertificate')
cert = cert[0] cert = cert[0]
serial = unicode(x509.get_serial_number(cert, x509.DER)) serial = unicode(x509.get_serial_number(cert, x509.DER))
@ -75,7 +75,7 @@ class test_ldap(object):
raise nose.SkipTest('Missing ccache %s' % self.ccache) raise nose.SkipTest('Missing ccache %s' % self.ccache)
self.conn = ldap2(shared_instance=False, ldap_uri=self.ldapuri) self.conn = ldap2(shared_instance=False, ldap_uri=self.ldapuri)
self.conn.connect(ccache='FILE:%s' % self.ccache) self.conn.connect(ccache='FILE:%s' % self.ccache)
(dn, entry_attrs) = self.conn.get_entry(self.dn, ['usercertificate']) entry_attrs = self.conn.get_entry(self.dn, ['usercertificate'])
cert = entry_attrs.get('usercertificate') cert = entry_attrs.get('usercertificate')
cert = cert[0] cert = cert[0]
serial = unicode(x509.get_serial_number(cert, x509.DER)) serial = unicode(x509.get_serial_number(cert, x509.DER))
@ -94,7 +94,7 @@ class test_ldap(object):
raise nose.SkipTest("No directory manager password in %s" % pwfile) raise nose.SkipTest("No directory manager password in %s" % pwfile)
self.conn = ldap2(shared_instance=False, ldap_uri=self.ldapuri) self.conn = ldap2(shared_instance=False, ldap_uri=self.ldapuri)
self.conn.connect(bind_dn=DN(('cn', 'directory manager')), bind_pw=dm_password) self.conn.connect(bind_dn=DN(('cn', 'directory manager')), bind_pw=dm_password)
(dn, entry_attrs) = self.conn.get_entry(self.dn, ['usercertificate']) entry_attrs = self.conn.get_entry(self.dn, ['usercertificate'])
cert = entry_attrs.get('usercertificate') cert = entry_attrs.get('usercertificate')
cert = cert[0] cert = cert[0]
serial = unicode(x509.get_serial_number(cert, x509.DER)) serial = unicode(x509.get_serial_number(cert, x509.DER))
@ -142,7 +142,7 @@ class test_ldap(object):
self.conn.connect(autobind=True) self.conn.connect(autobind=True)
except errors.ACIError: except errors.ACIError:
raise nose.SkipTest("Only executed as root") raise nose.SkipTest("Only executed as root")
(dn, entry_attrs) = self.conn.get_entry(self.dn, ['usercertificate']) entry_attrs = self.conn.get_entry(self.dn, ['usercertificate'])
cert = entry_attrs.get('usercertificate') cert = entry_attrs.get('usercertificate')
cert = cert[0] cert = cert[0]
serial = unicode(x509.get_serial_number(cert, x509.DER)) serial = unicode(x509.get_serial_number(cert, x509.DER))

View File

@ -1306,7 +1306,7 @@ class test_netgroup(Declarative):
# raise nose.SkipTest('compat and nis are not enabled, skipping test') # raise nose.SkipTest('compat and nis are not enabled, skipping test')
# finally: # finally:
# conn.disconnect() # conn.disconnect()
# triples = entries[0][0][1]['nisnetgrouptriple'] # triples = entries[0][0]['nisnetgrouptriple']
# #
# # This may not prove to be reliable since order is not guaranteed # # This may not prove to be reliable since order is not guaranteed
# # and even which user gets into which triple can be random. # # and even which user gets into which triple can be random.