summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2013-05-14 06:20:18 -0700
committerStefan Metzmacher <metze@samba.org>2013-05-15 16:19:23 +0200
commitfbb12b574df69a1cda0a3f201f21279650ddc4c4 (patch)
tree067ec25d8b9a62057ee3836824ef8840708f7d71 /python
parent54f4536980d86faf532708c92890dd9e8b09667a (diff)
downloadsamba-fbb12b574df69a1cda0a3f201f21279650ddc4c4.tar.gz
samba-fbb12b574df69a1cda0a3f201f21279650ddc4c4.tar.bz2
samba-fbb12b574df69a1cda0a3f201f21279650ddc4c4.zip
samba-tool/tests: Force the gecos of the user to a fixed value.
When --gecos is not specified samba-tool user add will try to read the gecos field from a getpw call. And if user's GECOS is empty (like the build user on sn-devel-104) then the test will fail because we can't add an empty gecos. Signed-off-by: Matthieu Patou <mat@matws.net> Reviewed-by: Jelmer Vernooij <jelmer@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Wed May 15 16:19:23 CEST 2013 on sn-devel-104
Diffstat (limited to 'python')
-rw-r--r--python/samba/tests/samba_tool/user.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/python/samba/tests/samba_tool/user.py b/python/samba/tests/samba_tool/user.py
index 89fa22b812..645eb402c6 100644
--- a/python/samba/tests/samba_tool/user.py
+++ b/python/samba/tests/samba_tool/user.py
@@ -212,12 +212,20 @@ class UserCmdTestCase(SambaToolCmdTest):
self.skipTest("Skipping getpwent test, current EUID not found in NSS")
return
+
+# samba-tool user add command didn't support users with empty gecos if none is
+# specified on the command line and the user hasn't one in the passwd file it
+# will fail, so let's add some contents
+
+ gecos = u[4]
+ if (gecos is None or len(gecos) == 0):
+ gecos = "Foo GECOS"
user = self._randomPosixUser({
"name": u[0],
"uid": u[0],
"uidNumber": u[2],
"gidNumber": u[3],
- "gecos": u[4],
+ "gecos": gecos,
"loginShell": u[6],
})
# check if --rfc2307-from-nss sets the same values as we got from pwd.getpwuid()
@@ -228,6 +236,7 @@ class UserCmdTestCase(SambaToolCmdTest):
"--department=%s" % user["department"],
"--description=%s" % user["description"],
"--company=%s" % user["company"],
+ "--gecos=%s" % user["gecos"],
"--rfc2307-from-nss",
"-H", "ldap://%s" % os.environ["DC_SERVER"],
"-U%s%%%s" % (os.environ["DC_USERNAME"], os.environ["DC_PASSWORD"]))