The branch, master has been updated
via 94af158 s4:selftest: fix a message-typo in the "samba-tool user"
testsuite.
via a85d861 s4:selftest: add a new test for "samba-tool user list"
via e625a31 testtools/matchers.py: fix a comment typo
from db0ea16 s3-spoolss: Check return type of update_dsspooler().
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 94af1581ef5458438ee883cdec204502e448ddde
Author: Michael Adam <[email protected]>
Date: Wed Mar 14 01:00:06 2012 +0100
s4:selftest: fix a message-typo in the "samba-tool user" testsuite.
Autobuild-User: Michael Adam <[email protected]>
Autobuild-Date: Wed Mar 14 21:19:11 CET 2012 on sn-devel-104
commit a85d86129a8ff4e0ca5874fe9a858a81d5627043
Author: Michael Adam <[email protected]>
Date: Fri Mar 9 14:32:55 2012 +0100
s4:selftest: add a new test for "samba-tool user list"
commit e625a319e25acb66a772493914f33aad43c09322
Author: Michael Adam <[email protected]>
Date: Fri Mar 9 12:00:32 2012 +0100
testtools/matchers.py: fix a comment typo
-----------------------------------------------------------------------
Summary of changes:
lib/testtools/testtools/matchers.py | 2 +-
.../python/samba/tests/samba_tool/user.py | 30 ++++++++++++++++++-
2 files changed, 29 insertions(+), 3 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/testtools/testtools/matchers.py
b/lib/testtools/testtools/matchers.py
index 3279306..3ea47d8 100644
--- a/lib/testtools/testtools/matchers.py
+++ b/lib/testtools/testtools/matchers.py
@@ -642,7 +642,7 @@ class MatchesException(Matcher):
class Contains(Matcher):
- """Checks whether something is container in another thing."""
+ """Checks whether something is contained in another thing."""
def __init__(self, needle):
"""Create a Contains Matcher.
diff --git a/source4/scripting/python/samba/tests/samba_tool/user.py
b/source4/scripting/python/samba/tests/samba_tool/user.py
index 3e00ed3..15d04d6 100644
--- a/source4/scripting/python/samba/tests/samba_tool/user.py
+++ b/source4/scripting/python/samba/tests/samba_tool/user.py
@@ -19,7 +19,10 @@ import os
import time
import ldb
from samba.tests.samba_tool.base import SambaToolCmdTest
-from samba import nttime2unix
+from samba import (
+ nttime2unix,
+ dsdb
+ )
class UserCmdTestCase(SambaToolCmdTest):
"""Tests for samba-tool user subcommands"""
@@ -64,7 +67,7 @@ class UserCmdTestCase(SambaToolCmdTest):
# try to add all the users again, this should fail
for user in self.users:
(result, out, err) = self._create_user(user)
- self.assertCmdFail(result, "Ensure that create user files")
+ self.assertCmdFail(result, "Ensure that create user fails")
self.assertIn("LDAP error 68 LDAP_ENTRY_ALREADY_EXISTS", err)
# try to delete all the 4 users we just added
@@ -174,6 +177,29 @@ class UserCmdTestCase(SambaToolCmdTest):
self.assertWithin(expires, twodays, 5, "Ensure account expires
is within 5 seconds of the expected time")
+ def test_list(self):
+ (result, out, err) = self.runsubcmd("user", "list",
+ "-H", "ldap://%s" %
os.environ["DC_SERVER"],
+ "-U%s%%%s" %
(os.environ["DC_USERNAME"],
+
os.environ["DC_PASSWORD"]))
+ self.assertCmdSuccess(result, "Error runing list")
+
+ search_filter = ("(&(objectClass=user)(userAccountControl:%s:=%u))" %
+ (ldb.OID_COMPARATOR_AND, dsdb.UF_NORMAL_ACCOUNT))
+
+ userlist = self.samdb.search(base=self.samdb.domain_dn(),
+ scope=ldb.SCOPE_SUBTREE,
+ expression=search_filter,
+ attrs=["samaccountname"])
+
+ self.assertTrue(len(userlist) > 0, "no users found in samdb")
+
+ for userobj in userlist:
+ name = userobj.get("samaccountname", idx=0)
+ found = self.assertMatch(out, name,
+ "user '%s' not found" % name)
+
+
def _randomUser(self, base={}):
"""create a user with random attribute values, you can specify base
attributes"""
user = {
--
Samba Shared Repository