1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

samba-tool: Test creating unix user with modified template homedir

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
David Mulder 2020-08-27 13:13:06 -06:00 committed by Jeremy Allison
parent 0c461f3bd5
commit 38fcad60a8
2 changed files with 9 additions and 0 deletions

View File

@ -41,6 +41,12 @@ class UserCmdTestCase(SambaToolCmdTest):
super(UserCmdTestCase, self).setUp()
self.samdb = self.getSamDB("-H", "ldap://%s" % os.environ["DC_SERVER"],
"-U%s%%%s" % (os.environ["DC_USERNAME"], os.environ["DC_PASSWORD"]))
# Modify the default template homedir
lp = self.get_loadparm()
self.template_homedir = lp.get('template homedir')
lp.set('template homedir', '/home/test/%D/%U')
self.users = []
self.users.append(self._randomUser({"name": "sambatool1", "company": "comp1"}))
self.users.append(self._randomUser({"name": "sambatool2", "company": "comp1"}))
@ -83,6 +89,7 @@ class UserCmdTestCase(SambaToolCmdTest):
cachedb = lp.private_path("user-syncpasswords-cache.ldb")
if os.path.exists(cachedb):
os.remove(cachedb)
lp.set('template homedir', self.template_homedir)
def test_newuser(self):
# try to add all the users again, this should fail
@ -645,6 +652,7 @@ template """
self.assertEqual("%s" % found.get("gidNumber"), "%s" %
user["gidNumber"])
self.assertEqual("%s" % found.get("uid"), user["uid"])
self.assertIn('/home/test/', "%s" % found.get("unixHomeDirectory"))
self._check_user(user)
def _create_user(self, user):

View File

@ -0,0 +1 @@
samba.tests.samba_tool.user.samba.tests.samba_tool.user.UserCmdTestCase