From: Joseph Sutton Date: Thu, 2 Dec 2021 03:50:55 +0000 (+1300) Subject: tests/krb5: Only create testing accounts once per test run X-Git-Tag: tdb-1.4.6~446 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=10983779bc5d50cdb69b64656cbc56f0250e3f23;p=thirdparty%2Fsamba.git tests/krb5: Only create testing accounts once per test run This decreases the time that the tests take to run. Signed-off-by: Joseph Sutton Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/tests/krb5/as_canonicalization_tests.py b/python/samba/tests/krb5/as_canonicalization_tests.py index 674fcb37101..7c64ce19bb7 100755 --- a/python/samba/tests/krb5/as_canonicalization_tests.py +++ b/python/samba/tests/krb5/as_canonicalization_tests.py @@ -134,6 +134,12 @@ USER_NAME = "tstkrb5cnnusr" @DynamicTestCase class KerberosASCanonicalizationTests(KDCBaseTest): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.user_creds = None + cls.machine_creds = None + @classmethod def setUpDynamicTestCases(cls): @@ -164,14 +170,14 @@ class KerberosASCanonicalizationTests(KDCBaseTest): def user_account_creds(self): if self.user_creds is None: samdb = self.get_samdb() - self.user_creds, _ = self.create_account(samdb, USER_NAME) + type(self).user_creds, _ = self.create_account(samdb, USER_NAME) return self.user_creds def machine_account_creds(self): if self.machine_creds is None: samdb = self.get_samdb() - self.machine_creds, _ = self.create_account( + type(self).machine_creds, _ = self.create_account( samdb, MACHINE_NAME, account_type=self.AccountType.COMPUTER) @@ -185,9 +191,6 @@ class KerberosASCanonicalizationTests(KDCBaseTest): self.do_asn1_print = global_asn1_print self.do_hexdump = global_hexdump - self.user_creds = None - self.machine_creds = None - def _test_with_args(self, x, ct): if ct == CredentialsType.User: creds = self.user_account_creds()