From 48c75bade7fe68f3fcaf075a97bcdb80b448bbb7 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 10 Jan 2008 17:47:58 +0100 Subject: configure: Complain when Python is not found. (This used to be commit 6aaccdb0b38366963d5bdff444d24d6dcacc817b) --- source4/scripting/python/config.m4 | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'source4/scripting/python') diff --git a/source4/scripting/python/config.m4 b/source4/scripting/python/config.m4 index 326cef8440..348f9197f7 100644 --- a/source4/scripting/python/config.m4 +++ b/source4/scripting/python/config.m4 @@ -65,8 +65,5 @@ then LIBS="$ac_save_LIBS" CFLAGS="$ac_save_CFLAGS" else - SMB_ENABLE(EXT_LIB_PYTHON,NO) - SMB_ENABLE(LIBPYTHONyy,NO) - SMB_ENABLE(smbpython,NO) - AC_MSG_RESULT([no]) + AC_MSG_ERROR([Python not found. Please install Python 2.x and its development headers/libraries.]) fi -- cgit From 63aa4b902144873243e37eb7d7ce91d30b886abc Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 9 Feb 2008 20:47:12 +0100 Subject: Remove unused define. (This used to be commit 64d6d729135e1b3b19c9bdbbe973fcdaca15e8b3) --- source4/scripting/python/config.m4 | 1 - 1 file changed, 1 deletion(-) (limited to 'source4/scripting/python') diff --git a/source4/scripting/python/config.m4 b/source4/scripting/python/config.m4 index 1f03ec8e34..908efd1588 100644 --- a/source4/scripting/python/config.m4 +++ b/source4/scripting/python/config.m4 @@ -66,7 +66,6 @@ if test $working_python = yes; then SMB_ENABLE(EXT_LIB_PYTHON,YES) SMB_ENABLE(smbpython,YES) SMB_ENABLE(LIBPYTHON,YES) - AC_DEFINE(HAVE_WORKING_PYTHON, 1, [Whether we have working python support]) AC_MSG_RESULT([yes]) else AC_MSG_ERROR([Python not found. Please install Python 2.x and its development headers/libraries.]) -- cgit From 2cf29aebff0dc821487e60ce86c18c6bbf1be866 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 9 Feb 2008 22:29:42 +0100 Subject: Add tests for upgrade of WINS database. (This used to be commit 7777611c0f32a693f0fa057c130e4ea491658f6b) --- source4/scripting/python/samba/tests/upgrade.py | 19 +++++++++++++++++-- source4/scripting/python/samba/upgrade.py | 4 +++- 2 files changed, 20 insertions(+), 3 deletions(-) (limited to 'source4/scripting/python') diff --git a/source4/scripting/python/samba/tests/upgrade.py b/source4/scripting/python/samba/tests/upgrade.py index ddafa00691..4dc86ace8a 100644 --- a/source4/scripting/python/samba/tests/upgrade.py +++ b/source4/scripting/python/samba/tests/upgrade.py @@ -17,6 +17,21 @@ # along with this program. If not, see . # -import samba.upgrade -from unittest import TestCase +from samba import Ldb +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) + } + import_wins(self.ldb, winsdb) + + self.assertEquals(['name=FOO,type=0x20'], + [str(m.dn) for m in self.ldb.search(expression="(objectClass=winsRecord)")]) + + def test_version(self): + import_wins(self.ldb, {}) + self.assertEquals("VERSION", + self.ldb.search(expression="(objectClass=winsMaxVersion)")[0]["cn"]) diff --git a/source4/scripting/python/samba/upgrade.py b/source4/scripting/python/samba/upgrade.py index 8bf75d776e..01b62ff984 100644 --- a/source4/scripting/python/samba/upgrade.py +++ b/source4/scripting/python/samba/upgrade.py @@ -18,6 +18,7 @@ from samba import Ldb from samba.samdb import SamDB def import_sam_policy(samldb, samba3_policy, domaindn): + """Import a Samba 3 policy database.""" samldb.modify_ldif(""" dn: %s changetype: modify @@ -201,7 +202,8 @@ def import_wins(samba4_winsdb, samba3_winsdb): "versionID": str(version_id), "address": ips}) - samba4_winsdb.add({"dn": "CN=VERSION", + samba4_winsdb.add({"dn": "cn=VERSION", + "cn": "VERSION", "objectClass": "winsMaxVersion", "maxVersion": str(version_id)}) -- cgit From af007e5837ac472f0527505c8013b837932136bc Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 11 Feb 2008 13:20:24 +0100 Subject: Use SMB_CONF_PATH environment variable inside tests rather than hardcoded paths. (This used to be commit eb04de69c0e319e18b148191946808f81e1cc8c4) --- source4/scripting/python/samba/tests/__init__.py | 6 ++++++ source4/scripting/python/samba/tests/dcerpc/registry.py | 4 ++-- source4/scripting/python/samba/tests/dcerpc/rpcecho.py | 5 ++--- source4/scripting/python/samba/tests/dcerpc/sam.py | 3 ++- source4/scripting/python/samba/tests/provision.py | 3 +-- 5 files changed, 13 insertions(+), 8 deletions(-) (limited to 'source4/scripting/python') diff --git a/source4/scripting/python/samba/tests/__init__.py b/source4/scripting/python/samba/tests/__init__.py index 9402002674..c8673d3fae 100644 --- a/source4/scripting/python/samba/tests/__init__.py +++ b/source4/scripting/python/samba/tests/__init__.py @@ -84,3 +84,9 @@ class LdbExtensionTests(TestCaseInTempDir): del l os.unlink(path) + +def get_loadparm(): + import param + lp = param.LoadParm() + lp.load(os.getenv("SMB_CONF_PATH")) + return lp diff --git a/source4/scripting/python/samba/tests/dcerpc/registry.py b/source4/scripting/python/samba/tests/dcerpc/registry.py index f3f0b0fb1a..147acc5098 100644 --- a/source4/scripting/python/samba/tests/dcerpc/registry.py +++ b/source4/scripting/python/samba/tests/dcerpc/registry.py @@ -20,11 +20,11 @@ import winreg from param import LoadParm import unittest +from samba.tests import get_loadparm class WinregTests(unittest.TestCase): def setUp(self): - lp_ctx = LoadParm() - lp_ctx.load("st/client/client.conf") + lp_ctx = get_loadparm() self.conn = winreg.winreg("ncalrpc:", lp_ctx) def get_hklm(self): diff --git a/source4/scripting/python/samba/tests/dcerpc/rpcecho.py b/source4/scripting/python/samba/tests/dcerpc/rpcecho.py index 52c2bb8c72..8c1a8bec71 100644 --- a/source4/scripting/python/samba/tests/dcerpc/rpcecho.py +++ b/source4/scripting/python/samba/tests/dcerpc/rpcecho.py @@ -18,13 +18,12 @@ # import echo -from param import LoadParm import unittest +from samba.tests import get_loadparm class RpcEchoTests(unittest.TestCase): def setUp(self): - lp_ctx = LoadParm() - lp_ctx.load("st/client/client.conf") + lp_ctx = get_loadparm() self.conn = echo.rpcecho("ncalrpc:", lp_ctx) def test_addone(self): diff --git a/source4/scripting/python/samba/tests/dcerpc/sam.py b/source4/scripting/python/samba/tests/dcerpc/sam.py index 50caaf2348..96348f2f69 100644 --- a/source4/scripting/python/samba/tests/dcerpc/sam.py +++ b/source4/scripting/python/samba/tests/dcerpc/sam.py @@ -19,10 +19,11 @@ import samr import unittest +from samba.tests import get_loadparm class SamrTests(unittest.TestCase): def setUp(self): - self.conn = samr.samr("ncalrpc:", "st/client/client.conf") + self.conn = samr.samr("ncalrpc:", get_loadparm()) def test_connect5(self): (level, info, handle) = self.conn.Connect5(None, 0, 1, samr.ConnectInfo1()) diff --git a/source4/scripting/python/samba/tests/provision.py b/source4/scripting/python/samba/tests/provision.py index 54a7782b3d..514582cbe4 100644 --- a/source4/scripting/python/samba/tests/provision.py +++ b/source4/scripting/python/samba/tests/provision.py @@ -24,8 +24,7 @@ from ldb import Dn import param import unittest -lp = param.LoadParm() -lp.load("st/dc/etc/smb.conf") +lp = samba.tests.get_loadparm() setup_dir = "setup" def setup_path(file): -- cgit