From: Rob van der Linde Date: Wed, 25 Oct 2023 22:18:04 +0000 (+1300) Subject: python: tests: improve comments for auth silo and policy tests X-Git-Tag: talloc-2.4.2~987 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2dd06ae41a2154db82378587fa662a35bf78c386;p=thirdparty%2Fsamba.git python: tests: improve comments for auth silo and policy tests Signed-off-by: Rob van der Linde Reviewed-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/tests/samba_tool/domain_auth_base.py b/python/samba/tests/samba_tool/domain_auth_base.py index 2bf619c7bd9..7d1e13393b0 100644 --- a/python/samba/tests/samba_tool/domain_auth_base.py +++ b/python/samba/tests/samba_tool/domain_auth_base.py @@ -46,7 +46,7 @@ class BaseAuthCmdTest(SambaToolCmdTest): cls.create_authentication_silo( name="Developers", - description="Developers, Developers", + description="Developers, Developers, Developers!", user_authentication_policy="User Policy") cls.create_authentication_silo( name="Managers", diff --git a/python/samba/tests/samba_tool/domain_auth_policy.py b/python/samba/tests/samba_tool/domain_auth_policy.py index 1d7079c78c4..b0bfdded7e2 100644 --- a/python/samba/tests/samba_tool/domain_auth_policy.py +++ b/python/samba/tests/samba_tool/domain_auth_policy.py @@ -636,10 +636,12 @@ class AuthPolicyCmdTestCase(BaseAuthCmdTest): "--name=deleteForceFail", "--protect") self.assertIsNone(result, msg=err) + + # Policy exists policy = self.get_authentication_policy("deleteForceFail") self.assertIsNotNone(policy) - # Try delete with --force. + # Try doing delete with --force. # Patch SDUtils.dacl_delete_aces with a Mock that raises ModelError. with patch.object(SDUtils, "dacl_delete_aces") as delete_mock: delete_mock.side_effect = ModelError("Custom error message") @@ -657,6 +659,8 @@ class AuthPolicyCmdTestCase(BaseAuthCmdTest): result, out, err = self.runcmd("domain", "auth", "policy", "create", "--name=regularPolicy") self.assertIsNone(result, msg=err) + + # Policy exists policy = self.get_authentication_policy("regularPolicy") self.assertIsNotNone(policy) @@ -680,6 +684,8 @@ class AuthPolicyCmdTestCase(BaseAuthCmdTest): "--name=protectedPolicy", "--protect") self.assertIsNone(result, msg=err) + + # Policy exists policy = self.get_authentication_policy("protectedPolicy") self.assertIsNotNone(policy) diff --git a/python/samba/tests/samba_tool/domain_auth_silo.py b/python/samba/tests/samba_tool/domain_auth_silo.py index 59f5c279633..b9d2e96e4ec 100644 --- a/python/samba/tests/samba_tool/domain_auth_silo.py +++ b/python/samba/tests/samba_tool/domain_auth_silo.py @@ -71,7 +71,8 @@ class AuthSiloCmdTestCase(BaseAuthCmdTest): # check a few fields only self.assertEqual(silo["cn"], "Developers") - self.assertEqual(silo["description"], "Developers, Developers") + self.assertEqual(silo["description"], + "Developers, Developers, Developers!") def test_view__notfound(self): """Test viewing an authentication silo that doesn't exist.""" @@ -412,10 +413,12 @@ class AuthSiloCmdTestCase(BaseAuthCmdTest): "--user-authentication-policy", "User Policy", "--protect") self.assertIsNone(result, msg=err) + + # Silo exists silo = self.get_authentication_silo("deleteForceFail") self.assertIsNotNone(silo) - # Try delete with --force. + # Try doing delete with --force. # Patch SDUtils.dacl_delete_aces with a Mock that raises ModelError. with patch.object(SDUtils, "dacl_delete_aces") as delete_mock: delete_mock.side_effect = ModelError("Custom error message") @@ -434,6 +437,8 @@ class AuthSiloCmdTestCase(BaseAuthCmdTest): "--name=regularSilo", "--user-authentication-policy", "User Policy") self.assertIsNone(result, msg=err) + + # Silo exists silo = self.get_authentication_silo("regularSilo") self.assertIsNotNone(silo) @@ -458,6 +463,8 @@ class AuthSiloCmdTestCase(BaseAuthCmdTest): "--user-authentication-policy", "User Policy", "--protect") self.assertIsNone(result, msg=err) + + # Silo exists silo = self.get_authentication_silo("protectedSilo") self.assertIsNotNone(silo)