diff options
| author | Rob van der Linde <rob@catalyst.net.nz> | 2023-09-28 17:26:22 +1300 |
|---|---|---|
| committer | Andrew Bartlett <abartlet@samba.org> | 2023-09-29 02:18:34 +0000 |
| commit | 27cd59820859d57e93e8e6595580934c47fe75e8 (patch) | |
| tree | c2d2bfff3b9265334af67237c26c0592d8ce2f2e /python | |
| parent | 2a3335545946e3d6c06204912b2a7c8ad03e3de8 (diff) | |
| download | samba-27cd59820859d57e93e8e6595580934c47fe75e8.tar.gz samba-27cd59820859d57e93e8e6595580934c47fe75e8.tar.bz2 samba-27cd59820859d57e93e8e6595580934c47fe75e8.zip | |
netcmd: tests: modify auth silo cli tests setup their own test data
Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'python')
| -rw-r--r-- | python/samba/tests/samba_tool/domain_auth_silo.py | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/python/samba/tests/samba_tool/domain_auth_silo.py b/python/samba/tests/samba_tool/domain_auth_silo.py index 53207b2f290..04e7578cfc8 100644 --- a/python/samba/tests/samba_tool/domain_auth_silo.py +++ b/python/samba/tests/samba_tool/domain_auth_silo.py @@ -231,59 +231,73 @@ class AuthSiloCmdTestCase(BaseAuthCmdTest): def test_authentication_silo_modify_description(self): """Test modify authentication silo changing the description field.""" - # check original value - silo = self.get_authentication_silo("qa") - self.assertNotEqual(str(silo["description"]), "Testing Team") + # Create a silo to modify for this test. + name = "modifyDescription" + self.runcmd("domain", "auth", "silo", "create", "--name", name) + self.addCleanup(self.delete_authentication_silo, + name=name, force=True) result, out, err = self.runcmd("domain", "auth", "silo", "modify", - "--name", "qa", - "--description", "Testing Team") + "--name", name, + "--description", "New Description") self.assertIsNone(result, msg=err) # check new value - silo = self.get_authentication_silo("qa") - self.assertEqual(str(silo["description"]), "Testing Team") + silo = self.get_authentication_silo(name) + self.assertEqual(str(silo["description"]), "New Description") def test_authentication_silo_modify_audit_enforce(self): """Test modify authentication silo setting --audit and --enforce.""" + # Create a silo to modify for this test. + name = "modifyEnforce" + self.runcmd("domain", "auth", "silo", "create", "--name", name) + self.addCleanup(self.delete_authentication_silo, + name=name, force=True) + result, out, err = self.runcmd("domain", "auth", "silo", "modify", - "--name", "Developers", + "--name", name, "--audit") self.assertIsNone(result, msg=err) # Check silo is set to audit. - silo = self.get_authentication_silo("developers") + silo = self.get_authentication_silo(name) self.assertEqual(str(silo["msDS-AuthNPolicySiloEnforced"]), "FALSE") result, out, err = self.runcmd("domain", "auth", "silo", "modify", - "--name", "Developers", + "--name", name, "--enforce") self.assertIsNone(result, msg=err) # Check is set to enforce. - silo = self.get_authentication_silo("developers") + silo = self.get_authentication_silo(name) self.assertEqual(str(silo["msDS-AuthNPolicySiloEnforced"]), "TRUE") def test_authentication_silo_modify_protect_unprotect(self): """Test modify un-protecting and protecting an authentication silo.""" + # Create a silo to modify for this test. + name = "modifyProtect" + self.runcmd("domain", "auth", "silo", "create", "--name", name) + self.addCleanup(self.delete_authentication_silo, + name=name, force=True) + utils = SDUtils(self.samdb) result, out, err = self.runcmd("domain", "auth", "silo", "modify", - "--name", "managers", + "--name", name, "--protect") self.assertIsNone(result, msg=err) # Check that silo was protected. - silo = self.get_authentication_silo("managers") + silo = self.get_authentication_silo(name) desc = utils.get_sd_as_sddl(silo["dn"]) self.assertIn("(D;;DTSD;;;WD)", desc) result, out, err = self.runcmd("domain", "auth", "silo", "modify", - "--name", "managers", + "--name", name, "--unprotect") self.assertIsNone(result, msg=err) # Check that silo was unprotected. - silo = self.get_authentication_silo("managers") + silo = self.get_authentication_silo(name) desc = utils.get_sd_as_sddl(silo["dn"]) self.assertNotIn("(D;;DTSD;;;WD)", desc) |
