summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/python/samba/tests/__init__.py17
-rw-r--r--source4/scripting/python/samba/tests/dcerpc/__init__.py2
-rw-r--r--source4/scripting/python/samba/tests/dcerpc/bare.py19
-rw-r--r--source4/scripting/python/samba/tests/dcerpc/misc.py6
-rw-r--r--source4/scripting/python/samba/tests/dcerpc/registry.py1
-rw-r--r--source4/scripting/python/samba/tests/dcerpc/rpcecho.py6
-rw-r--r--source4/scripting/python/samba/tests/dcerpc/sam.py1
-rw-r--r--source4/scripting/python/samba/tests/dcerpc/unix.py1
-rw-r--r--source4/scripting/python/samba/tests/netcmd.py5
-rw-r--r--source4/scripting/python/samba/tests/provision.py6
-rw-r--r--source4/scripting/python/samba/tests/samba3.py5
-rw-r--r--source4/scripting/python/samba/tests/shares.py2
-rw-r--r--source4/scripting/python/samba/tests/upgrade.py1
-rw-r--r--source4/scripting/python/samba/tests/xattr.py2
14 files changed, 42 insertions, 32 deletions
diff --git a/source4/scripting/python/samba/tests/__init__.py b/source4/scripting/python/samba/tests/__init__.py
index 78c4676aa7..0583f8856a 100644
--- a/source4/scripting/python/samba/tests/__init__.py
+++ b/source4/scripting/python/samba/tests/__init__.py
@@ -30,9 +30,10 @@ from testtools.testcase import TestCase, TestSkipped
class LdbTestCase(TestCase):
-
"""Trivial test case for running tests against a LDB."""
+
def setUp(self):
+ super(LdbTestCase, self).setUp()
self.filename = os.tempnam()
self.ldb = samba.Ldb(self.filename)
@@ -63,14 +64,16 @@ class SubstituteVarTestCase(TestCase):
self.assertEquals("", samba.substitute_var("", {}))
def test_nothing(self):
- self.assertEquals("foo bar", samba.substitute_var("foo bar", {"bar": "bla"}))
+ self.assertEquals("foo bar",
+ samba.substitute_var("foo bar", {"bar": "bla"}))
def test_replace(self):
- self.assertEquals("foo bla", samba.substitute_var("foo ${bar}", {"bar": "bla"}))
+ self.assertEquals("foo bla",
+ samba.substitute_var("foo ${bar}", {"bar": "bla"}))
def test_broken(self):
self.assertEquals("foo ${bdkjfhsdkfh sdkfh ",
- samba.substitute_var("foo ${bdkjfhsdkfh sdkfh ", {"bar": "bla"}))
+ samba.substitute_var("foo ${bdkjfhsdkfh sdkfh ", {"bar": "bla"}))
def test_unknown_var(self):
self.assertEquals("foo ${bla} gsff",
@@ -78,7 +81,8 @@ class SubstituteVarTestCase(TestCase):
def test_check_all_substituted(self):
samba.check_all_substituted("nothing to see here")
- self.assertRaises(Exception, samba.check_all_substituted, "Not subsituted: ${FOOBAR}")
+ self.assertRaises(Exception, samba.check_all_substituted,
+ "Not subsituted: ${FOOBAR}")
class LdbExtensionTests(TestCaseInTempDir):
@@ -88,7 +92,8 @@ class LdbExtensionTests(TestCaseInTempDir):
l = samba.Ldb(path)
try:
l.add({"dn": "foo=dc", "bar": "bla"})
- self.assertEquals("bla", l.searchone(basedn=ldb.Dn(l, "foo=dc"), attribute="bar"))
+ self.assertEquals("bla",
+ l.searchone(basedn=ldb.Dn(l, "foo=dc"), attribute="bar"))
finally:
del l
os.unlink(path)
diff --git a/source4/scripting/python/samba/tests/dcerpc/__init__.py b/source4/scripting/python/samba/tests/dcerpc/__init__.py
index c64c9dc9f6..e2b9b3f001 100644
--- a/source4/scripting/python/samba/tests/dcerpc/__init__.py
+++ b/source4/scripting/python/samba/tests/dcerpc/__init__.py
@@ -16,5 +16,5 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
+
diff --git a/source4/scripting/python/samba/tests/dcerpc/bare.py b/source4/scripting/python/samba/tests/dcerpc/bare.py
index e6811b0a3d..4051052b0c 100644
--- a/source4/scripting/python/samba/tests/dcerpc/bare.py
+++ b/source4/scripting/python/samba/tests/dcerpc/bare.py
@@ -19,31 +19,32 @@
#
from samba.dcerpc import ClientConnection
-from unittest import TestCase
-from samba.tests import env_loadparm
+import samba.tests
-
-class BareTestCase(TestCase):
+class BareTestCase(samba.tests.TestCase):
def test_bare(self):
# Connect to the echo pipe
x = ClientConnection("ncalrpc:localhost[DEFAULT]",
- ("60a15ec5-4de8-11d7-a637-005056a20182", 1), lp_ctx=env_loadparm())
+ ("60a15ec5-4de8-11d7-a637-005056a20182", 1),
+ lp_ctx=samba.tests.env_loadparm())
self.assertEquals("\x01\x00\x00\x00", x.request(0, chr(0) * 4))
def test_alter_context(self):
x = ClientConnection("ncalrpc:localhost[DEFAULT]",
- ("12345778-1234-abcd-ef00-0123456789ac", 1), lp_ctx=env_loadparm())
+ ("12345778-1234-abcd-ef00-0123456789ac", 1),
+ lp_ctx=samba.tests.env_loadparm())
y = ClientConnection("ncalrpc:localhost",
("60a15ec5-4de8-11d7-a637-005056a20182", 1),
- basis_connection=x, lp_ctx=env_loadparm())
+ basis_connection=x, lp_ctx=samba.tests.env_loadparm())
x.alter_context(("60a15ec5-4de8-11d7-a637-005056a20182", 1))
# FIXME: self.assertEquals("\x01\x00\x00\x00", x.request(0, chr(0) * 4))
def test_two_connections(self):
x = ClientConnection("ncalrpc:localhost[DEFAULT]",
- ("60a15ec5-4de8-11d7-a637-005056a20182", 1), lp_ctx=env_loadparm())
+ ("60a15ec5-4de8-11d7-a637-005056a20182", 1),
+ lp_ctx=samba.tests.env_loadparm())
y = ClientConnection("ncalrpc:localhost",
("60a15ec5-4de8-11d7-a637-005056a20182", 1),
- basis_connection=x, lp_ctx=env_loadparm())
+ basis_connection=x, lp_ctx=samba.tests.env_loadparm())
self.assertEquals("\x01\x00\x00\x00", y.request(0, chr(0) * 4))
diff --git a/source4/scripting/python/samba/tests/dcerpc/misc.py b/source4/scripting/python/samba/tests/dcerpc/misc.py
index ab76efc536..2adf86aa9e 100644
--- a/source4/scripting/python/samba/tests/dcerpc/misc.py
+++ b/source4/scripting/python/samba/tests/dcerpc/misc.py
@@ -17,13 +17,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-import unittest
from samba.dcerpc import misc
+import samba.tests
text1 = "76f53846-a7c2-476a-ae2c-20e2b80d7b34"
text2 = "344edffa-330a-4b39-b96e-2c34da52e8b1"
-class GUIDTests(unittest.TestCase):
+class GUIDTests(samba.tests.TestCase):
def test_str(self):
guid = misc.GUID(text1)
@@ -45,7 +45,7 @@ class GUIDTests(unittest.TestCase):
self.assertEquals(guid1, guid2)
-class PolicyHandleTests(unittest.TestCase):
+class PolicyHandleTests(samba.tests.TestCase):
def test_init(self):
x = misc.policy_handle(text1, 1)
diff --git a/source4/scripting/python/samba/tests/dcerpc/registry.py b/source4/scripting/python/samba/tests/dcerpc/registry.py
index f1cd83790d..5ff256ed01 100644
--- a/source4/scripting/python/samba/tests/dcerpc/registry.py
+++ b/source4/scripting/python/samba/tests/dcerpc/registry.py
@@ -24,6 +24,7 @@ from samba.tests import RpcInterfaceTestCase
class WinregTests(RpcInterfaceTestCase):
def setUp(self):
+ super(WinregTests, self).setUp()
self.conn = winreg.winreg("ncalrpc:", self.get_loadparm(),
self.get_credentials())
diff --git a/source4/scripting/python/samba/tests/dcerpc/rpcecho.py b/source4/scripting/python/samba/tests/dcerpc/rpcecho.py
index 72eb87d750..f1f765c990 100644
--- a/source4/scripting/python/samba/tests/dcerpc/rpcecho.py
+++ b/source4/scripting/python/samba/tests/dcerpc/rpcecho.py
@@ -19,13 +19,13 @@
from samba.dcerpc import echo
from samba.ndr import ndr_pack, ndr_unpack
-import unittest
-from samba.tests import RpcInterfaceTestCase
+from samba.tests import RpcInterfaceTestCase, TestCase
class RpcEchoTests(RpcInterfaceTestCase):
def setUp(self):
+ super(RpcEchoTests, self).setUp()
self.conn = echo.rpcecho("ncalrpc:", self.get_loadparm())
def test_two_contexts(self):
@@ -59,7 +59,7 @@ class RpcEchoTests(RpcInterfaceTestCase):
self.assertEquals(None, self.conn.server_name)
-class NdrEchoTests(unittest.TestCase):
+class NdrEchoTests(TestCase):
def test_info1_push(self):
x = echo.info1()
diff --git a/source4/scripting/python/samba/tests/dcerpc/sam.py b/source4/scripting/python/samba/tests/dcerpc/sam.py
index 333f8d12b5..df943a11ba 100644
--- a/source4/scripting/python/samba/tests/dcerpc/sam.py
+++ b/source4/scripting/python/samba/tests/dcerpc/sam.py
@@ -32,6 +32,7 @@ def toArray((handle, array, num_entries)):
class SamrTests(RpcInterfaceTestCase):
def setUp(self):
+ super(SamrTests, self).setUp()
self.conn = samr.samr("ncalrpc:", self.get_loadparm())
def test_connect5(self):
diff --git a/source4/scripting/python/samba/tests/dcerpc/unix.py b/source4/scripting/python/samba/tests/dcerpc/unix.py
index 62169ad12c..7a3e715685 100644
--- a/source4/scripting/python/samba/tests/dcerpc/unix.py
+++ b/source4/scripting/python/samba/tests/dcerpc/unix.py
@@ -23,6 +23,7 @@ from samba.tests import RpcInterfaceTestCase
class UnixinfoTests(RpcInterfaceTestCase):
def setUp(self):
+ super(UnixinfoTests, self).setUp()
self.conn = unixinfo.unixinfo("ncalrpc:", self.get_loadparm())
def test_getpwuid(self):
diff --git a/source4/scripting/python/samba/tests/netcmd.py b/source4/scripting/python/samba/tests/netcmd.py
index ecd8dc439e..4b911facf1 100644
--- a/source4/scripting/python/samba/tests/netcmd.py
+++ b/source4/scripting/python/samba/tests/netcmd.py
@@ -17,11 +17,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-import unittest
-
from samba.netcmd import Command
+import samba.tests
-class CommandTests(unittest.TestCase):
+class CommandTests(samba.tests.TestCase):
def test_name(self):
class cmd_foo(Command):
diff --git a/source4/scripting/python/samba/tests/provision.py b/source4/scripting/python/samba/tests/provision.py
index 22e4553f02..dd18aa0ff6 100644
--- a/source4/scripting/python/samba/tests/provision.py
+++ b/source4/scripting/python/samba/tests/provision.py
@@ -20,8 +20,7 @@
import os
from samba.provision import setup_secretsdb, findnss
import samba.tests
-from samba.tests import env_loadparm
-import unittest
+from samba.tests import env_loadparm, TestCase
setup_dir = "setup"
def setup_path(file):
@@ -42,8 +41,9 @@ class ProvisionTestCase(samba.tests.TestCaseInTempDir):
os.unlink(path)
-class FindNssTests(unittest.TestCase):
+class FindNssTests(TestCase):
"""Test findnss() function."""
+
def test_nothing(self):
def x(y):
raise KeyError
diff --git a/source4/scripting/python/samba/tests/samba3.py b/source4/scripting/python/samba/tests/samba3.py
index d7418b303d..f81ef486c0 100644
--- a/source4/scripting/python/samba/tests/samba3.py
+++ b/source4/scripting/python/samba/tests/samba3.py
@@ -24,8 +24,8 @@ from samba.samba3 import (WinsDatabase, SmbpasswdFile, ACB_NORMAL,
from samba.tests import TestCase
import os
-DATADIR=os.path.join(os.path.dirname(__file__), "../../../../../testdata/samba3")
-print "Samba 3 data dir: %s" % DATADIR
+DATADIR = os.path.join(os.path.dirname(__file__),
+ "../../../../../testdata/samba3")
class RegistryTestCase(TestCase):
@@ -35,6 +35,7 @@ class RegistryTestCase(TestCase):
def tearDown(self):
self.registry.close()
+ super(RegistryTestCase, self).tearDown()
def test_length(self):
self.assertEquals(28, len(self.registry))
diff --git a/source4/scripting/python/samba/tests/shares.py b/source4/scripting/python/samba/tests/shares.py
index 160e3cf883..10f17503e5 100644
--- a/source4/scripting/python/samba/tests/shares.py
+++ b/source4/scripting/python/samba/tests/shares.py
@@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from samba.shares import SharesContainer
-from unittest import TestCase
+from samba.tests import TestCase
class MockService(object):
diff --git a/source4/scripting/python/samba/tests/upgrade.py b/source4/scripting/python/samba/tests/upgrade.py
index 67a89a3dbc..56180071f8 100644
--- a/source4/scripting/python/samba/tests/upgrade.py
+++ b/source4/scripting/python/samba/tests/upgrade.py
@@ -21,6 +21,7 @@ from samba.upgrade import import_wins
from samba.tests import LdbTestCase
class WinsUpgradeTests(LdbTestCase):
+
def test_upgrade(self):
winsdb = {
"FOO#20": (200, ["127.0.0.1", "127.0.0.2"], 0x60)
diff --git a/source4/scripting/python/samba/tests/xattr.py b/source4/scripting/python/samba/tests/xattr.py
index 9bfe52c67e..32999984ea 100644
--- a/source4/scripting/python/samba/tests/xattr.py
+++ b/source4/scripting/python/samba/tests/xattr.py
@@ -20,7 +20,7 @@
import samba.xattr_native, samba.xattr_tdb
from samba.dcerpc import xattr
from samba.ndr import ndr_pack
-from testtools.testcase import TestCase, TestSkipped
+from samba.tests import TestCase, TestSkipped
import random
import os