summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib')
-rwxr-xr-xsource4/lib/ldb/tests/python/api.py5
-rwxr-xr-xsource4/lib/ldb/tests/python/ldap.py4
-rwxr-xr-xsource4/lib/ldb/tests/python/ldap_schema.py5
-rwxr-xr-xsource4/lib/ldb/tests/python/passwords.py3
-rwxr-xr-xsource4/lib/ldb/tests/python/sec_descriptor.py24
-rwxr-xr-xsource4/lib/ldb/tests/python/urgent_replication.py4
-rw-r--r--source4/lib/messaging/tests/bindings.py3
-rw-r--r--source4/lib/registry/tests/bindings.py9
8 files changed, 32 insertions, 25 deletions
diff --git a/source4/lib/ldb/tests/python/api.py b/source4/lib/ldb/tests/python/api.py
index 6303f6b6cb..4b4415afb1 100755
--- a/source4/lib/ldb/tests/python/api.py
+++ b/source4/lib/ldb/tests/python/api.py
@@ -2,12 +2,9 @@
# Simple tests for the ldb python bindings.
# Copyright (C) 2007 Jelmer Vernooij <jelmer@samba.org>
-import os, sys
+import os
import unittest
-# Required for the standalone LDB build
-sys.path.append("build/lib.linux-i686-2.4")
-
import ldb
def filename():
diff --git a/source4/lib/ldb/tests/python/ldap.py b/source4/lib/ldb/tests/python/ldap.py
index db1a47ce64..98ff628dfe 100755
--- a/source4/lib/ldb/tests/python/ldap.py
+++ b/source4/lib/ldb/tests/python/ldap.py
@@ -81,6 +81,7 @@ class BasicTests(unittest.TestCase):
return ndr_unpack( security.dom_sid,res[0]["objectSid"][0])
def setUp(self):
+ super(BasicTests, self).setUp()
self.ldb = ldb
self.gc_ldb = gc_ldb
self.base_dn = self.find_basedn(ldb)
@@ -2569,8 +2570,11 @@ nTSecurityDescriptor:: """ + desc_base64
finally:
self.delete_force(self.ldb, user_dn)
+
class BaseDnTests(unittest.TestCase):
+
def setUp(self):
+ super(BaseDnTests, self).setUp()
self.ldb = ldb
def test_rootdse_attrs(self):
diff --git a/source4/lib/ldb/tests/python/ldap_schema.py b/source4/lib/ldb/tests/python/ldap_schema.py
index ceebe11187..8e6865a4d2 100755
--- a/source4/lib/ldb/tests/python/ldap_schema.py
+++ b/source4/lib/ldb/tests/python/ldap_schema.py
@@ -45,6 +45,7 @@ creds = credopts.get_credentials(lp)
class SchemaTests(unittest.TestCase):
+
def delete_force(self, ldb, dn):
try:
ldb.delete(dn)
@@ -63,6 +64,7 @@ class SchemaTests(unittest.TestCase):
return res[0]["defaultNamingContext"][0]
def setUp(self):
+ super(SchemaTests, self).setUp()
self.ldb = ldb
self.schema_dn = self.find_schemadn(ldb)
self.base_dn = self.find_basedn(ldb)
@@ -214,6 +216,7 @@ name: """ + object_name + """
class SchemaTests_msDS_IntId(unittest.TestCase):
def setUp(self):
+ super(SchemaTests_msDS_IntId, self).setUp()
self.ldb = ldb
res = ldb.search(base="", expression="", scope=SCOPE_BASE, attrs=["*"])
self.assertEquals(len(res), 1)
@@ -481,9 +484,11 @@ systemOnly: FALSE
else:
self.assertTrue("msDS-IntId" not in ldb_msg)
+
class SchemaTests_msDS_isRODC(unittest.TestCase):
def setUp(self):
+ super(SchemaTests_msDS_isRODC, self).setUp()
self.ldb = ldb
res = ldb.search(base="", expression="", scope=SCOPE_BASE, attrs=["*"])
self.assertEquals(len(res), 1)
diff --git a/source4/lib/ldb/tests/python/passwords.py b/source4/lib/ldb/tests/python/passwords.py
index b3e6fc949e..dd5a1ca126 100755
--- a/source4/lib/ldb/tests/python/passwords.py
+++ b/source4/lib/ldb/tests/python/passwords.py
@@ -12,7 +12,6 @@
import optparse
import sys
-import time
import base64
import os
@@ -75,6 +74,7 @@ class PasswordTests(samba.tests.TestCase):
return res[0]["defaultNamingContext"][0]
def setUp(self):
+ super(PasswordTests, self).setUp()
self.ldb = ldb
self.base_dn = self.find_basedn(ldb)
@@ -558,6 +558,7 @@ userPassword: thatsAcomplPASS4
"userPassword": ["thatsAcomplPASS1", "thatsAcomplPASS1"] })
def tearDown(self):
+ super(PasswordTests, self).tearDown()
self.delete_force(self.ldb, "cn=testuser,cn=users," + self.base_dn)
self.delete_force(self.ldb, "cn=testuser2,cn=users," + self.base_dn)
# Close the second LDB connection (with the user credentials)
diff --git a/source4/lib/ldb/tests/python/sec_descriptor.py b/source4/lib/ldb/tests/python/sec_descriptor.py
index 43437fa186..91f607714e 100755
--- a/source4/lib/ldb/tests/python/sec_descriptor.py
+++ b/source4/lib/ldb/tests/python/sec_descriptor.py
@@ -19,7 +19,6 @@ from ldb import SCOPE_SUBTREE, SCOPE_BASE, LdbError, ERR_NO_SUCH_OBJECT
from samba.ndr import ndr_pack, ndr_unpack
from samba.dcerpc import security
-from samba import Ldb
from samba import gensec
from samba.samdb import SamDB
from samba.credentials import Credentials
@@ -28,6 +27,7 @@ from samba.dsdb import DS_DOMAIN_FUNCTION_2008
from samba.dcerpc.security import (
SECINFO_OWNER, SECINFO_GROUP, SECINFO_DACL, SECINFO_SACL)
from subunit.run import SubunitTestRunner
+import samba.tests
import unittest
parser = optparse.OptionParser("sec_descriptor [options] <host>")
@@ -54,7 +54,7 @@ creds.set_gensec_features(creds.get_gensec_features() | gensec.FEATURE_SEAL)
# Tests start here
#
-class DescriptorTests(unittest.TestCase):
+class DescriptorTests(samba.tests.TestCase):
def delete_force(self, ldb, dn):
try:
@@ -271,6 +271,7 @@ member: """ + self.get_users_domain_dn(username)
self.ldb_admin.enable_account("(sAMAccountName=" + username + ")")
def setUp(self):
+ super(DescriptorTests, self).setUp()
self.ldb_admin = ldb
self.base_dn = self.find_basedn(self.ldb_admin)
self.configuration_dn = self.find_configurationdn(self.ldb_admin)
@@ -307,7 +308,7 @@ class OwnerGroupDescriptorTests(DescriptorTests):
self.delete_force(self.ldb_admin, "CN=test-container1,CN=DisplaySpecifiers," + self.configuration_dn)
def setUp(self):
- DescriptorTests.setUp(self)
+ super(OwnerGroupDescriptorTests, self).setUp()
self.deleteAll()
### Create users
# User 1
@@ -453,6 +454,7 @@ class OwnerGroupDescriptorTests(DescriptorTests):
self.DS_BEHAVIOR = "ds_behavior_win2008"
def tearDown(self):
+ super(DescriptorTests, self).tearDown()
self.deleteAll()
def check_user_belongs(self, user_dn, groups=[]):
@@ -1364,10 +1366,7 @@ class DaclDescriptorTests(DescriptorTests):
self.delete_force(self.ldb_admin, "OU=test_inherit_ou," + self.base_dn)
def setUp(self):
- DescriptorTests.setUp(self)
- self.deleteAll()
-
- def tearDown(self):
+ super(DaclDescriptorTests, self).setUp()
self.deleteAll()
def create_clean_ou(self, object_dn):
@@ -1696,13 +1695,10 @@ class SdFlagsDescriptorTests(DescriptorTests):
self.delete_force(self.ldb_admin, "OU=test_sdflags_ou," + self.base_dn)
def setUp(self):
- DescriptorTests.setUp(self)
+ super(SdFlagsDescriptorTests, self).setUp()
self.test_descr = "O:AUG:AUD:(D;;CC;;;LG)S:(OU;;WP;;;AU)"
self.deleteAll()
- def tearDown(self):
- self.deleteAll()
-
def test_301(self):
""" Modify a descriptor with OWNER_SECURITY_INFORMATION set.
See that only the owner has been changed.
@@ -1849,6 +1845,7 @@ class SdFlagsDescriptorTests(DescriptorTests):
self.assertFalse("S:" in desc_sddl)
self.assertFalse("G:" in desc_sddl)
+
class RightsAttributesTests(DescriptorTests):
def deleteAll(self):
@@ -1857,7 +1854,7 @@ class RightsAttributesTests(DescriptorTests):
self.delete_force(self.ldb_admin, "OU=test_domain_ou1," + self.base_dn)
def setUp(self):
- DescriptorTests.setUp(self)
+ super(RightsAttributesTests, self).setUp()
self.deleteAll()
### Create users
# User 1
@@ -1866,9 +1863,6 @@ class RightsAttributesTests(DescriptorTests):
self.create_enable_user("testuser_attr2")
self.add_user_to_group(self.ldb_admin, "testuser_attr2", "Domain Admins")
- def tearDown(self):
- self.deleteAll()
-
def test_sDRightsEffective(self):
object_dn = "OU=test_domain_ou1," + self.base_dn
self.delete_force(self.ldb_admin, object_dn)
diff --git a/source4/lib/ldb/tests/python/urgent_replication.py b/source4/lib/ldb/tests/python/urgent_replication.py
index 78200efc30..26f7d9b46d 100755
--- a/source4/lib/ldb/tests/python/urgent_replication.py
+++ b/source4/lib/ldb/tests/python/urgent_replication.py
@@ -15,6 +15,7 @@ from samba.auth import system_session
from ldb import (SCOPE_BASE, LdbError, ERR_NO_SUCH_OBJECT, Message,
MessageElement, Dn, FLAG_MOD_REPLACE)
from samba.samdb import SamDB
+import samba.tests
from subunit.run import SubunitTestRunner
import unittest
@@ -37,7 +38,7 @@ host = args[0]
lp = sambaopts.get_loadparm()
creds = credopts.get_credentials(lp)
-class UrgentReplicationTests(unittest.TestCase):
+class UrgentReplicationTests(samba.tests.TestCase):
def delete_force(self, ldb, dn):
try:
@@ -52,6 +53,7 @@ class UrgentReplicationTests(unittest.TestCase):
return res[0]["defaultNamingContext"][0]
def setUp(self):
+ super(UrgentReplicationTests, self).setUp()
self.ldb = ldb
self.base_dn = self.find_basedn(ldb)
diff --git a/source4/lib/messaging/tests/bindings.py b/source4/lib/messaging/tests/bindings.py
index 8240a364b0..91cf024555 100644
--- a/source4/lib/messaging/tests/bindings.py
+++ b/source4/lib/messaging/tests/bindings.py
@@ -19,9 +19,10 @@
#
from samba.messaging import Messaging
-from unittest import TestCase
+from samba.tests import TestCase
class MessagingTests(TestCase):
+
def get_context(self, *args, **kwargs):
kwargs["messaging_path"] = "."
return Messaging(*args, **kwargs)
diff --git a/source4/lib/registry/tests/bindings.py b/source4/lib/registry/tests/bindings.py
index b5115aefa4..d01ebff909 100644
--- a/source4/lib/registry/tests/bindings.py
+++ b/source4/lib/registry/tests/bindings.py
@@ -18,11 +18,11 @@
#
import os
-import unittest
from samba import registry
import samba.tests
-class HelperTests(unittest.TestCase):
+class HelperTests(samba.tests.TestCase):
+
def test_predef_to_name(self):
self.assertEquals("HKEY_LOCAL_MACHINE",
registry.get_predef_name(0x80000002))
@@ -33,6 +33,7 @@ class HelperTests(unittest.TestCase):
class HiveTests(samba.tests.TestCaseInTempDir):
+
def setUp(self):
super(HiveTests, self).setUp()
self.hive_path = os.path.join(self.tempdir, "ldb_new.ldb")
@@ -41,6 +42,7 @@ class HiveTests(samba.tests.TestCaseInTempDir):
def tearDown(self):
del self.hive
os.unlink(self.hive_path)
+ super(HiveTests, self).tearDown()
def test_ldb_new(self):
self.assertTrue(self.hive is not None)
@@ -52,6 +54,7 @@ class HiveTests(samba.tests.TestCaseInTempDir):
# self.hive.del_value("FOO")
-class RegistryTests(unittest.TestCase):
+class RegistryTests(samba.tests.TestCase):
+
def test_new(self):
self.registry = registry.Registry()