selftest: fix failing user setpassword test
authorRob van der Linde <rob@catalyst.net.nz>
Thu, 14 Dec 2023 23:36:14 +0000 (12:36 +1300)
committerDouglas Bagnall <dbagnall@samba.org>
Thu, 21 Dec 2023 02:05:38 +0000 (02:05 +0000)
A side effect of being able to generate at read time unicodePwd for a gMSA is that we can also generate the unicodePwd from a virtualSambaGPG password.

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
python/samba/tests/samba_tool/user.py
selftest/knownfail.d/samba_tool_user [deleted file]

index 00f667bc48717ecc79d5cc177b47ea66e3e6a609..26c9748ffc329173d41b9fed4dca5681236d8dab 100644 (file)
@@ -324,7 +324,7 @@ class UserCmdTestCase(SambaToolCmdTest):
                              "syncpasswords --no-wait: 'sAMAccountName': %s out[%s]" % (user["name"], out))
             self.assertMatch(out, "# unicodePwd::: REDACTED SECRET ATTRIBUTE",
                              "getpassword '# unicodePwd::: REDACTED SECRET ATTRIBUTE': out[%s]" % out)
-            if expect_nt_hash:
+            if expect_nt_hash or "virtualSambaGPG:: " in out:
                 self.assertMatch(out, "unicodePwd:: %s" % unicodePwd,
                                  "getpassword unicodePwd: out[%s]" % out)
             else:
@@ -349,7 +349,7 @@ class UserCmdTestCase(SambaToolCmdTest):
             self.assertEqual(err, "Got password OK\n", "getpassword without url")
             self.assertMatch(out, "sAMAccountName: %s" % (user["name"]),
                              "getpassword: 'sAMAccountName': %s out[%s]" % (user["name"], out))
-            if expect_nt_hash:
+            if expect_nt_hash or "virtualSambaGPG:: " in out:
                 self.assertMatch(out, "unicodePwd:: %s" % unicodePwd,
                                  "getpassword unicodePwd: out[%s]" % out)
             else:
diff --git a/selftest/knownfail.d/samba_tool_user b/selftest/knownfail.d/samba_tool_user
deleted file mode 100644 (file)
index a558a1f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-^samba.tests.samba_tool.user.samba.tests.samba_tool.user.UserCmdTestCase.test_setpassword\(ad_dc_no_ntlm