From bb77f36f49c7866f8353b68129202a1e7793bc14 Mon Sep 17 00:00:00 2001 From: Joseph Sutton Date: Mon, 2 Oct 2023 14:25:52 +1300 Subject: [PATCH] s4:dsdb:tests: Fix assertion messages Signed-off-by: Joseph Sutton Reviewed-by: Andrew Bartlett --- source4/dsdb/tests/python/password_settings.py | 4 ++-- source4/dsdb/tests/python/user_account_control.py | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/source4/dsdb/tests/python/password_settings.py b/source4/dsdb/tests/python/password_settings.py index 1fc0c05cdd4..cdaad051a62 100644 --- a/source4/dsdb/tests/python/password_settings.py +++ b/source4/dsdb/tests/python/password_settings.py @@ -604,7 +604,7 @@ class PasswordSettingsTestCase(PasswordTestCase): operation=FLAG_MOD_REPLACE) except ldb.LdbError as e: (num, msg) = e.args - self.fail("Failed to change user into a workstation: {msg}") + self.fail(f"Failed to change user into a workstation: {msg}") self.assertIsNone(user.get_resultant_PSO()) try: @@ -614,7 +614,7 @@ class PasswordSettingsTestCase(PasswordTestCase): operation=FLAG_MOD_REPLACE) except ldb.LdbError as e: (num, msg) = e.args - self.fail("Failed to change user back into a user: {msg}") + self.fail(f"Failed to change user back into a user: {msg}") self.assertTrue(user.get_resultant_PSO() == dummy_pso.dn) # no PSO should be returned if RID is equal to DOMAIN_USER_RID_KRBTGT diff --git a/source4/dsdb/tests/python/user_account_control.py b/source4/dsdb/tests/python/user_account_control.py index f8af24d69e6..af5b0e9ea99 100755 --- a/source4/dsdb/tests/python/user_account_control.py +++ b/source4/dsdb/tests/python/user_account_control.py @@ -479,9 +479,8 @@ class UserAccountControlTests(samba.tests.TestCase): ldb.FLAG_MOD_REPLACE, "userAccountControl") self.assertRaisesLdbError([ldb.ERR_OBJECT_CLASS_VIOLATION, ldb.ERR_UNWILLING_TO_PERFORM], - f"Unexpectedly able to set userAccountControl to be an Normal " - "account without |UF_PASSWD_NOTREQD Unexpectedly able to " - "set userAccountControl to be a workstation on {m.dn}", + "Unexpectedly able to set userAccountControl to be a Normal " + "account without |UF_PASSWD_NOTREQD", self.samdb.modify, m) @@ -505,9 +504,9 @@ class UserAccountControlTests(samba.tests.TestCase): UF_TRUSTED_FOR_DELEGATION), ldb.FLAG_MOD_REPLACE, "userAccountControl") self.assertRaisesLdbError(ldb.ERR_OTHER, - f"Unexpectedly able to set userAccountControl to " + "Unexpectedly able to set userAccountControl to " "UF_WORKSTATION_TRUST_ACCOUNT|UF_PARTIAL_SECRETS_ACCOUNT|" - "UF_TRUSTED_FOR_DELEGATION on {m.dn}", + f"UF_TRUSTED_FOR_DELEGATION on {m.dn}", self.admin_samdb.modify, m) m = ldb.Message() @@ -1267,7 +1266,7 @@ class UserAccountControlTests(samba.tests.TestCase): self.admin_samdb.add(msg_dict) if (objectclass == "user" and account_type != UF_NORMAL_ACCOUNT): - self.fail("Able to create {account_type_str} on {objectclass}") + self.fail(f"Able to create {account_type_str} on {objectclass}") except LdbError as e: (enum, estr) = e.args self.assertEqual(enum, ldb.ERR_OBJECT_CLASS_VIOLATION) @@ -1288,7 +1287,7 @@ class UserAccountControlTests(samba.tests.TestCase): self.assertRaisesLdbError([ldb.ERR_OBJECT_CLASS_VIOLATION, ldb.ERR_UNWILLING_TO_PERFORM], - "Should have been unable Able to change objectclass of a {objectclass}", + f"Should have been unable to change objectclass of a {objectclass}", self.admin_samdb.modify, m) runner = SubunitTestRunner() -- 2.47.3