>From 663e53b899c19696b7da607e520e14cadf719031 Mon Sep 17 00:00:00 2001 From: Matthieu Patou Date: Tue, 14 May 2013 06:20:18 -0700 Subject: [PATCH] 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 --- python/samba/tests/samba_tool/user.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python/samba/tests/samba_tool/user.py b/python/samba/tests/samba_tool/user.py index 89fa22b..7983b10 100644 --- a/python/samba/tests/samba_tool/user.py +++ b/python/samba/tests/samba_tool/user.py @@ -212,12 +212,15 @@ class UserCmdTestCase(SambaToolCmdTest): self.skipTest("Skipping getpwent test, current EUID not found in NSS") return + 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 +231,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"])) -- 1.7.9.5