1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00

s4-tests: Acl tests should use the existing samdb domain_dn method instead of defining a new one

This commit is contained in:
Nadezhda Ivanova 2010-11-18 13:13:35 +02:00
parent 56512fb1da
commit 763165c7bc

View File

@ -64,12 +64,6 @@ class AclTests(samba.tests.TestCase):
except LdbError, (num, _): except LdbError, (num, _):
self.assertEquals(num, ERR_NO_SUCH_OBJECT) self.assertEquals(num, ERR_NO_SUCH_OBJECT)
def find_basedn(self, ldb):
res = ldb.search(base="", expression="", scope=SCOPE_BASE,
attrs=["defaultNamingContext"])
self.assertEquals(len(res), 1)
return res[0]["defaultNamingContext"][0]
def find_domain_sid(self, ldb): def find_domain_sid(self, ldb):
res = ldb.search(base=self.base_dn, expression="(objectClass=*)", scope=SCOPE_BASE) res = ldb.search(base=self.base_dn, expression="(objectClass=*)", scope=SCOPE_BASE)
return ndr_unpack(security.dom_sid,res[0]["objectSid"][0]) return ndr_unpack(security.dom_sid,res[0]["objectSid"][0])
@ -77,7 +71,7 @@ class AclTests(samba.tests.TestCase):
def setUp(self): def setUp(self):
super(AclTests, self).setUp() super(AclTests, self).setUp()
self.ldb_admin = ldb self.ldb_admin = ldb
self.base_dn = self.find_basedn(self.ldb_admin) self.base_dn = ldb.domain_dn()
self.domain_sid = self.find_domain_sid(self.ldb_admin) self.domain_sid = self.find_domain_sid(self.ldb_admin)
self.user_pass = "samba123@" self.user_pass = "samba123@"
res = self.ldb_admin.search(base="", expression="", scope=SCOPE_BASE, res = self.ldb_admin.search(base="", expression="", scope=SCOPE_BASE,