diff options
author | Björn Baumbach <bb@sernet.de> | 2017-11-29 15:22:20 +0100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2018-02-08 04:58:10 +0100 |
commit | 87ddbb67201bedaa8f042a2b5175d795eec2cb7e (patch) | |
tree | 440af0e8bdbc26bc15113f47d28df9ca3e564f99 /python | |
parent | 6fbfe84c011adc6a426dbd92e779a8759ba80989 (diff) | |
download | samba-87ddbb67201bedaa8f042a2b5175d795eec2cb7e.tar.gz |
tests/samba-tool: add test for samba-tool user show command
Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Diffstat (limited to 'python')
-rw-r--r-- | python/samba/tests/samba_tool/user.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/python/samba/tests/samba_tool/user.py b/python/samba/tests/samba_tool/user.py index 10e4f6cd839..a61da3be524 100644 --- a/python/samba/tests/samba_tool/user.py +++ b/python/samba/tests/samba_tool/user.py @@ -366,6 +366,28 @@ class UserCmdTestCase(SambaToolCmdTest): name = userobj.get("samaccountname", idx=0) found = self.assertMatch(out, name, "user '%s' not found" % name) + + def test_show(self): + for user in self.users: + (result, out, err) = self.runsubcmd( + "user", "show", user["name"], + "--attributes=sAMAccountName,company", + "-H", "ldap://%s" % os.environ["DC_SERVER"], + "-U%s%%%s" % (os.environ["DC_USERNAME"], + os.environ["DC_PASSWORD"])) + self.assertCmdSuccess(result, out, err, "Error running show") + + expected_out = """dn: CN=%s %s,CN=Users,%s +company: %s +sAMAccountName: %s + +""" % (user["given-name"], user["surname"], self.samdb.domain_dn(), + user["company"], user["name"]) + + self.assertEqual(out, expected_out, + "Unexpected show output for user '%s'" % + user["name"]) + def test_getpwent(self): try: import pwd |