mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
s4-tests: Modified speedtest.py to use samba.tests.delete_force
Autobuild-User: Nadezhda Ivanova <nivanova@samba.org> Autobuild-Date: Thu Nov 25 01:28:19 CET 2010 on sn-devel-104
This commit is contained in:
parent
21aceb1374
commit
fc1da86d40
@ -46,6 +46,7 @@ from samba import gensec
|
||||
from samba.samdb import SamDB
|
||||
from samba.credentials import Credentials
|
||||
import samba.tests
|
||||
from samba.tests import delete_force
|
||||
from subunit.run import SubunitTestRunner
|
||||
import unittest
|
||||
|
||||
@ -76,12 +77,6 @@ creds.set_gensec_features(creds.get_gensec_features() | gensec.FEATURE_SEAL)
|
||||
|
||||
class SpeedTest(samba.tests.TestCase):
|
||||
|
||||
def delete_force(self, ldb, dn):
|
||||
try:
|
||||
ldb.delete(dn)
|
||||
except LdbError, (num, _):
|
||||
self.assertEquals(num, ERR_NO_SUCH_OBJECT)
|
||||
|
||||
def find_basedn(self, ldb):
|
||||
res = ldb.search(base="", expression="", scope=SCOPE_BASE,
|
||||
attrs=["defaultNamingContext"])
|
||||
@ -126,13 +121,13 @@ url: www.example.com
|
||||
|
||||
def remove_bundle(self, count):
|
||||
for i in range(count):
|
||||
self.delete_force(self.ldb_admin, "cn=speedtestuser%d,cn=Users,%s" % (i+1, self.base_dn))
|
||||
delete_force(self.ldb_admin, "cn=speedtestuser%d,cn=Users,%s" % (i+1, self.base_dn))
|
||||
|
||||
def remove_test_users(self):
|
||||
res = ldb.search(base="cn=Users,%s" % self.base_dn, expression="(objectClass=user)", scope=SCOPE_SUBTREE)
|
||||
dn_list = [item.dn for item in res if "speedtestuser" in str(item.dn)]
|
||||
for dn in dn_list:
|
||||
self.delete_force(self.ldb_admin, dn)
|
||||
delete_force(self.ldb_admin, dn)
|
||||
|
||||
def run_bundle(self, num):
|
||||
print "\n=== Test ADD/DEL %s user objects ===\n" % num
|
||||
|
Loading…
Reference in New Issue
Block a user