summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/python/samba/tests/upgrade.py19
-rw-r--r--source4/scripting/python/samba/upgrade.py4
2 files changed, 20 insertions, 3 deletions
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 <http://www.gnu.org/licenses/>.
#
-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)})