summaryrefslogtreecommitdiffstats
path: root/source4/scripting/python/samba/tests/samba3.py
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-12-23 19:19:41 -0600
committerStefan Metzmacher <metze@samba.org>2007-12-24 01:51:03 -0600
commitaa0a06f13c44e0eca0b3f2f0c34f0f7995b87159 (patch)
tree92c180a6928f94f64934e2fab842768c134fed63 /source4/scripting/python/samba/tests/samba3.py
parent784c22899f211fa42728e784c2f2e6e5701ddcac (diff)
downloadsamba-aa0a06f13c44e0eca0b3f2f0c34f0f7995b87159.tar.gz
samba-aa0a06f13c44e0eca0b3f2f0c34f0f7995b87159.tar.xz
samba-aa0a06f13c44e0eca0b3f2f0c34f0f7995b87159.zip
r26570: - Trim size of the swig-generated Python bindings by removing a bunch of {}'s.
- Start working on Python equivalents for various EJS tests. - Fix regression in argument order for reg_diff_apply() in EJS bindings. (This used to be commit c550c03372cb260b78f6a6c132e70571bc4cb852)
Diffstat (limited to 'source4/scripting/python/samba/tests/samba3.py')
-rw-r--r--source4/scripting/python/samba/tests/samba3.py57
1 files changed, 57 insertions, 0 deletions
diff --git a/source4/scripting/python/samba/tests/samba3.py b/source4/scripting/python/samba/tests/samba3.py
new file mode 100644
index 00000000000..c6b6281c603
--- /dev/null
+++ b/source4/scripting/python/samba/tests/samba3.py
@@ -0,0 +1,57 @@
+#!/usr/bin/python
+
+# Unix SMB/CIFS implementation.
+# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+import unittest
+from samba.samba3 import GroupMappingDatabase, Registry, PolicyDatabase
+import os
+
+DATADIR=os.path.join(os.path.dirname(__file__), "../../../../../testdata/samba3")
+
+class RegistryTestCase(unittest.TestCase):
+ def setUp(self):
+ self.registry = Registry(os.path.join(DATADIR, "registry.tdb"))
+
+ def test_length(self):
+ self.assertEquals(28, len(self.registry))
+
+ def test_keys(self):
+ self.assertEquals([], self.registry.keys())
+
+
+class PolicyTestCase(unittest.TestCase):
+ def setUp(self):
+ self.policy = PolicyDatabase(os.path.join(DATADIR, "account_policy.tdb"))
+
+ def test_policy(self):
+ self.assertEquals(self.policy.min_password_length, 5)
+ self.assertEquals(self.policy.minimum_password_age, 0)
+ self.assertEquals(self.policy.maximum_password_age, 999999999)
+ self.assertEquals(self.policy.refuse_machine_password_change, 0)
+ self.assertEquals(self.policy.reset_count_minutes, 0)
+ self.assertEquals(self.policy.disconnect_time, -1)
+ self.assertEquals(self.policy.user_must_logon_to_change_password, 0)
+ self.assertEquals(self.policy.password_history, 0)
+ self.assertEquals(self.policy.lockout_duration, 0)
+ self.assertEquals(self.policy.bad_lockout_minutes, 0)
+
+
+class GroupsTestCase(unittest.TestCase):
+ def setUp(self):
+ self.groupdb = GroupMappingDatabase(os.path.join(DATADIR, "group_mapping.tdb"))
+