s4:dsdb:tests: Fix assertion messages
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Mon, 2 Oct 2023 01:25:52 +0000 (14:25 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 13 Oct 2023 03:50:31 +0000 (03:50 +0000)
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/dsdb/tests/python/password_settings.py
source4/dsdb/tests/python/user_account_control.py

index 1fc0c05cdd4182730f258de7b0917601e97e386c..cdaad051a62ba22c74a2fc262f2df2b0013e8db0 100644 (file)
@@ -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
index f8af24d69e6481118f062c257e1845e2334bccbc..af5b0e9ea99e01b18ae810f4e32f15d9df5be2b4 100755 (executable)
@@ -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()