diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-02-09 22:29:42 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-02-09 22:29:42 +0100 |
commit | 2cf29aebff0dc821487e60ce86c18c6bbf1be866 (patch) | |
tree | b68606f0d19c018ad35aad5cc79800fd26f58aa9 /source4/scripting | |
parent | 63aa4b902144873243e37eb7d7ce91d30b886abc (diff) | |
download | samba-2cf29aebff0dc821487e60ce86c18c6bbf1be866.tar.gz samba-2cf29aebff0dc821487e60ce86c18c6bbf1be866.tar.bz2 samba-2cf29aebff0dc821487e60ce86c18c6bbf1be866.zip |
Add tests for upgrade of WINS database.
(This used to be commit 7777611c0f32a693f0fa057c130e4ea491658f6b)
Diffstat (limited to 'source4/scripting')
-rw-r--r-- | source4/scripting/python/samba/tests/upgrade.py | 19 | ||||
-rw-r--r-- | source4/scripting/python/samba/upgrade.py | 4 |
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)}) |