summaryrefslogtreecommitdiff
path: root/source4/scripting/python
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-05-30 12:18:07 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-05-30 12:18:07 +0200
commit5107f093c270f7a0dfc359de088b475fffc4e279 (patch)
tree99f616c6e352f87fbd41e60ad7fae3adf67e72fa /source4/scripting/python
parent46f22add9ae03b95f4b22235c297737475427f41 (diff)
parentbe1927cd80838a6807827cef4431c03160d52582 (diff)
downloadsamba-5107f093c270f7a0dfc359de088b475fffc4e279.tar.gz
samba-5107f093c270f7a0dfc359de088b475fffc4e279.tar.bz2
samba-5107f093c270f7a0dfc359de088b475fffc4e279.zip
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-defs
Conflicts: source/samba4-skip (This used to be commit 7b0e0eb346c2f6a240b20fbcf14029539c6512b9)
Diffstat (limited to 'source4/scripting/python')
-rw-r--r--source4/scripting/python/samba/provision.py5
-rw-r--r--source4/scripting/python/samba/tests/dcerpc/bare.py11
-rw-r--r--source4/scripting/python/samba/tests/dcerpc/rpcecho.py2
-rw-r--r--source4/scripting/python/samba/tests/samdb.py25
4 files changed, 30 insertions, 13 deletions
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py
index 71c1ac3187..b7112e16c3 100644
--- a/source4/scripting/python/samba/provision.py
+++ b/source4/scripting/python/samba/provision.py
@@ -930,8 +930,9 @@ def provision(setup_dir, message, session_info,
if aci is None:
aci = "# no aci for local ldb"
- if smbconf is None:
- os.makedirs(os.path.join(targetdir, "etc"))
+ if targetdir is not None:
+ if (not os.path.exists(os.path.join(targetdir, "etc"))):
+ os.makedirs(os.path.join(targetdir, "etc"))
smbconf = os.path.join(targetdir, "etc", "smb.conf")
# only install a new smb.conf if there isn't one there already
diff --git a/source4/scripting/python/samba/tests/dcerpc/bare.py b/source4/scripting/python/samba/tests/dcerpc/bare.py
index d75ffc381e..fae699a249 100644
--- a/source4/scripting/python/samba/tests/dcerpc/bare.py
+++ b/source4/scripting/python/samba/tests/dcerpc/bare.py
@@ -20,27 +20,28 @@
from samba.dcerpc import ClientConnection
from unittest import TestCase
+from samba.tests import cmdline_loadparm
class BareTestCase(TestCase):
def test_bare(self):
# Connect to the echo pipe
x = ClientConnection("ncalrpc:localhost[DEFAULT]",
- ("60a15ec5-4de8-11d7-a637-005056a20182", 1))
+ ("60a15ec5-4de8-11d7-a637-005056a20182", 1), lp_ctx=cmdline_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))
+ ("12345778-1234-abcd-ef00-0123456789ac", 1), lp_ctx=cmdline_loadparm)
y = ClientConnection("ncalrpc:localhost",
("60a15ec5-4de8-11d7-a637-005056a20182", 1),
- basis_connection=x)
+ basis_connection=x, lp_ctx=cmdline_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))
+ ("60a15ec5-4de8-11d7-a637-005056a20182", 1), lp_ctx=cmdline_loadparm)
y = ClientConnection("ncalrpc:localhost",
("60a15ec5-4de8-11d7-a637-005056a20182", 1),
- basis_connection=x)
+ basis_connection=x, lp_ctx=cmdline_loadparm)
self.assertEquals("\x01\x00\x00\x00", y.request(0, chr(0) * 4))
diff --git a/source4/scripting/python/samba/tests/dcerpc/rpcecho.py b/source4/scripting/python/samba/tests/dcerpc/rpcecho.py
index bbbd0d76ec..96bb3923a6 100644
--- a/source4/scripting/python/samba/tests/dcerpc/rpcecho.py
+++ b/source4/scripting/python/samba/tests/dcerpc/rpcecho.py
@@ -27,7 +27,7 @@ class RpcEchoTests(RpcInterfaceTestCase):
self.conn = echo.rpcecho("ncalrpc:", self.get_loadparm())
def test_two_contexts(self):
- self.conn2 = echo.rpcecho("ncalrpc:", basis_connection=self.conn)
+ self.conn2 = echo.rpcecho("ncalrpc:", self.get_loadparm(), basis_connection=self.conn)
self.assertEquals(3, self.conn2.AddOne(2))
def test_abstract_syntax(self):
diff --git a/source4/scripting/python/samba/tests/samdb.py b/source4/scripting/python/samba/tests/samdb.py
index 7e8ba053d4..fcf93a3fc6 100644
--- a/source4/scripting/python/samba/tests/samdb.py
+++ b/source4/scripting/python/samba/tests/samdb.py
@@ -19,12 +19,13 @@
from samba.auth import system_session
from samba.credentials import Credentials
import os
-from samba.provision import setup_samdb, guess_names, setup_templatesdb
+from samba.provision import setup_samdb, guess_names, setup_templatesdb, make_smbconf
from samba.samdb import SamDB
from samba.tests import cmdline_loadparm, TestCaseInTempDir
from samba import security
from unittest import TestCase
import uuid
+import param
class SamDBTestCase(TestCaseInTempDir):
def setUp(self):
@@ -43,9 +44,22 @@ class SamDBTestCase(TestCaseInTempDir):
hostguid = str(uuid.uuid4())
path = os.path.join(self.tempdir, "samdb.ldb")
session_info = system_session()
- names = guess_names(lp=cmdline_loadparm, hostname="foo",
- domain="EXAMPLE.COM", dnsdomain="example.com",
- serverrole="domain controller",
+
+ hostname="foo"
+ domain="EXAMPLE"
+ dnsdomain="example.com"
+ serverrole="domain controller"
+
+ smbconf = os.path.join(self.tempdir, "smb.conf")
+ make_smbconf(smbconf, setup_path, hostname, domain, dnsdomain, serverrole,
+ self.tempdir)
+
+ lp = param.LoadParm()
+ lp.load(smbconf)
+
+ names = guess_names(lp=lp, hostname=hostname,
+ domain=domain, dnsdomain=dnsdomain,
+ serverrole=severrole,
domaindn=self.domaindn, configdn=configdn,
schemadn=schemadn)
setup_templatesdb(os.path.join(self.tempdir, "templates.ldb"),
@@ -58,9 +72,10 @@ class SamDBTestCase(TestCaseInTempDir):
policyguid, False, "secret",
"secret", "secret", invocationid,
"secret", "domain controller")
+
def tearDown(self):
for f in ['templates.ldb', 'schema.ldb', 'configuration.ldb',
- 'users.ldb', 'samdb.ldb']:
+ 'users.ldb', 'samdb.ldb', 'smb.conf']:
os.remove(os.path.join(self.tempdir, f))
super(SamDBTestCase, self).tearDown()