From 6bcfcacd536f8fb82aacd533f39b74e663bd343d Mon Sep 17 00:00:00 2001 From: Rob van der Linde Date: Tue, 28 Nov 2023 15:11:12 +1300 Subject: [PATCH] python: PEP275: docstrings should always use double quotes Signed-off-by: Rob van der Linde Reviewed-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- python/samba/tests/dcerpc/rpc_talloc.py | 6 +- python/samba/tests/dcerpc/testrpc.py | 4 +- python/samba/tests/dns_base.py | 4 +- .../tests/krb5/as_canonicalization_tests.py | 2 +- python/samba/tests/krb5/kdc_base_test.py | 36 ++++---- python/samba/tests/krb5/kdc_tgs_tests.py | 8 +- .../ms_kile_client_principal_lookup_tests.py | 52 ++++++------ python/samba/tests/ldap_raw.py | 84 +++++++++---------- python/samba/tests/samba_tool/group.py | 4 +- python/samba/tests/smb3unix.py | 4 +- source4/dsdb/tests/python/passwords.py | 12 +-- 11 files changed, 108 insertions(+), 108 deletions(-) diff --git a/python/samba/tests/dcerpc/rpc_talloc.py b/python/samba/tests/dcerpc/rpc_talloc.py index 4d50f382d45..4ad86a6cf90 100644 --- a/python/samba/tests/dcerpc/rpc_talloc.py +++ b/python/samba/tests/dcerpc/rpc_talloc.py @@ -38,17 +38,17 @@ talloc.enable_null_tracking() class TallocTests(samba.tests.TestCase): - '''test talloc behaviour of pidl generated python code''' + """test talloc behaviour of pidl generated python code""" def check_blocks(self, object, num_expected): - '''check that the number of allocated blocks is correct''' + """check that the number of allocated blocks is correct""" nblocks = talloc.total_blocks(object) if object is None: nblocks -= self.initial_blocks self.assertEqual(nblocks, num_expected) def get_rodc_partial_attribute_set(self): - '''get a list of attributes for RODC replication''' + """get a list of attributes for RODC replication""" partial_attribute_set = drsuapi.DsPartialAttributeSet() # we expect one block for the object diff --git a/python/samba/tests/dcerpc/testrpc.py b/python/samba/tests/dcerpc/testrpc.py index fcc3b0477dc..789ea9af976 100644 --- a/python/samba/tests/dcerpc/testrpc.py +++ b/python/samba/tests/dcerpc/testrpc.py @@ -27,10 +27,10 @@ talloc.enable_null_tracking() class RpcTests(object): - '''test type behaviour of pidl generated python RPC code''' + """test type behaviour of pidl generated python RPC code""" def check_blocks(self, object, num_expected): - '''check that the number of allocated blocks is correct''' + """check that the number of allocated blocks is correct""" nblocks = talloc.total_blocks(object) if object is None: nblocks -= self.initial_blocks diff --git a/python/samba/tests/dns_base.py b/python/samba/tests/dns_base.py index b92371e9cdd..ab00e631772 100644 --- a/python/samba/tests/dns_base.py +++ b/python/samba/tests/dns_base.py @@ -363,8 +363,8 @@ class DNSTKeyTest(DNSTest): return mac def bad_sign_packet(self, packet, key_name): - '''Add bad signature for a packet by bitflipping - the final byte in the MAC''' + """Add bad signature for a packet by bitflipping + the final byte in the MAC""" mac_list = [x if isinstance(x, int) else ord(x) for x in list("badmac")] diff --git a/python/samba/tests/krb5/as_canonicalization_tests.py b/python/samba/tests/krb5/as_canonicalization_tests.py index 22ea14d3575..dd94cb632da 100755 --- a/python/samba/tests/krb5/as_canonicalization_tests.py +++ b/python/samba/tests/krb5/as_canonicalization_tests.py @@ -148,7 +148,7 @@ class KerberosASCanonicalizationTests(KDCBaseTest): def setUpDynamicTestCases(cls): def skip(ct, options): - ''' Filter out any mutually exclusive test options ''' + """ Filter out any mutually exclusive test options """ if ct != CredentialsType.Machine and\ TestOptions.RemoveDollar.is_set(options): return True diff --git a/python/samba/tests/krb5/kdc_base_test.py b/python/samba/tests/krb5/kdc_base_test.py index 17d64540524..373c73ecb9a 100644 --- a/python/samba/tests/krb5/kdc_base_test.py +++ b/python/samba/tests/krb5/kdc_base_test.py @@ -792,10 +792,10 @@ class KDCBaseTest(TestCaseInTempDir, RawKerberosTest): ou=None, account_control=0, add_dollar=None, expired_password=False, force_nt4_hash=False, preserve=True): - '''Create an account for testing. + """Create an account for testing. The dn of the created account is added to self.accounts, which is used by tearDownClass to clean up the created accounts. - ''' + """ if add_dollar is None and account_type is not self.AccountType.USER: add_dollar = True @@ -2592,8 +2592,8 @@ class KDCBaseTest(TestCaseInTempDir, RawKerberosTest): return creds, sname def as_req(self, cname, sname, realm, etypes, padata=None, kdc_options=0): - '''Send a Kerberos AS_REQ, returns the undecoded response - ''' + """Send a Kerberos AS_REQ, returns the undecoded response + """ till = self.get_KerberosTime(offset=36000) @@ -2613,8 +2613,8 @@ class KDCBaseTest(TestCaseInTempDir, RawKerberosTest): return rep def get_as_rep_key(self, creds, rep): - '''Extract the session key from an AS-REP - ''' + """Extract the session key from an AS-REP + """ rep_padata = self.der_decode( rep['e-data'], asn1Spec=krb5_asn1.METHOD_DATA()) @@ -2634,8 +2634,8 @@ class KDCBaseTest(TestCaseInTempDir, RawKerberosTest): return key def get_enc_timestamp_pa_data(self, creds, rep, skew=0): - '''generate the pa_data data element for an AS-REQ - ''' + """generate the pa_data data element for an AS-REQ + """ key = self.get_as_rep_key(creds, rep) @@ -2671,8 +2671,8 @@ class KDCBaseTest(TestCaseInTempDir, RawKerberosTest): return padata def get_as_rep_enc_data(self, key, rep): - ''' Decrypt and Decode the encrypted data in an AS-REP - ''' + """ Decrypt and Decode the encrypted data in an AS-REP + """ enc_part = key.decrypt(KU_AS_REP_ENC_PART, rep['enc-part']['cipher']) # MIT KDC encodes both EncASRepPart and EncTGSRepPart with # application tag 26 @@ -2749,9 +2749,9 @@ class KDCBaseTest(TestCaseInTempDir, RawKerberosTest): expected_error_mode=0, padata=None, kdc_options=0, to_rodc=False, creds=None, service_creds=None, expect_pac=True, expect_edata=None, expected_flags=None, unexpected_flags=None): - '''Send a TGS-REQ, returns the response and the decrypted and + """Send a TGS-REQ, returns the response and the decrypted and decoded enc-part - ''' + """ subkey = self.RandomKey(key.etype) @@ -3226,8 +3226,8 @@ class KDCBaseTest(TestCaseInTempDir, RawKerberosTest): "account_name account_sid logon_name upn domain_name") def get_pac_data(self, authorization_data): - '''Decode the PAC element contained in the authorization-data element - ''' + """Decode the PAC element contained in the authorization-data element + """ account_name = None user_sid = None logon_name = None @@ -3264,8 +3264,8 @@ class KDCBaseTest(TestCaseInTempDir, RawKerberosTest): domain_name) def decode_service_ticket(self, creds, ticket): - '''Decrypt and decode a service ticket - ''' + """Decrypt and decode a service ticket + """ enc_part = ticket['enc-part'] @@ -3295,9 +3295,9 @@ class KDCBaseTest(TestCaseInTempDir, RawKerberosTest): return enc_part def get_objectSid(self, samdb, dn): - ''' Get the objectSID for a DN + """ Get the objectSID for a DN Note: performs an Ldb query. - ''' + """ res = samdb.search(dn, scope=SCOPE_BASE, attrs=["objectSID"]) self.assertTrue(len(res) == 1, "did not get objectSid for %s" % dn) sid = samdb.schema_format_value("objectSID", res[0]["objectSID"][0]) diff --git a/python/samba/tests/krb5/kdc_tgs_tests.py b/python/samba/tests/krb5/kdc_tgs_tests.py index cef5d0db95c..58ed49d27c0 100755 --- a/python/samba/tests/krb5/kdc_tgs_tests.py +++ b/python/samba/tests/krb5/kdc_tgs_tests.py @@ -474,9 +474,9 @@ class KdcTgsTests(KdcTgsBaseTests): self.do_hexdump = global_hexdump def test_tgs_req_cname_does_not_not_match_authenticator_cname(self): - ''' Try and obtain a ticket from the TGS, but supply a cname + """ Try and obtain a ticket from the TGS, but supply a cname that differs from that provided to the krbtgt - ''' + """ # Create the user account samdb = self.get_samdb() user_name = "tsttktusr" @@ -528,8 +528,8 @@ class KdcTgsTests(KdcTgsBaseTests): "rep = {%s}" % rep) def test_ldap_service_ticket(self): - '''Get a ticket to the ldap service - ''' + """Get a ticket to the ldap service + """ # Create the user account samdb = self.get_samdb() user_name = "tsttktusr" diff --git a/python/samba/tests/krb5/ms_kile_client_principal_lookup_tests.py b/python/samba/tests/krb5/ms_kile_client_principal_lookup_tests.py index 9b541a6285e..4feb3bb7611 100755 --- a/python/samba/tests/krb5/ms_kile_client_principal_lookup_tests.py +++ b/python/samba/tests/krb5/ms_kile_client_principal_lookup_tests.py @@ -40,10 +40,10 @@ global_hexdump = False class MS_Kile_Client_Principal_Lookup_Tests(KDCBaseTest): - ''' Tests for MS-KILE client principal look-up + """ Tests for MS-KILE client principal look-up See [MS-KILE]: Kerberos Protocol Extensions section 3.3.5.6.1 Client Principal Lookup - ''' + """ def setUp(self): super().setUp() @@ -80,12 +80,12 @@ class MS_Kile_Client_Principal_Lookup_Tests(KDCBaseTest): "pac_data = {%s}" % str(pac_data)) def test_nt_principal_step_1(self): - ''' Step 1 + """ Step 1 For an NT_PRINCIPAL cname with no realm or the realm matches the DC's domain search for an account with the sAMAccountName matching the cname. - ''' + """ # Create user and machine accounts for the test. # @@ -142,11 +142,11 @@ class MS_Kile_Client_Principal_Lookup_Tests(KDCBaseTest): self.assertEqual(realm.upper().encode('UTF8'), enc_part['crealm']) def test_nt_principal_step_2(self): - ''' Step 2 + """ Step 2 If not found search for sAMAccountName equal to the cname + "$" - ''' + """ # Create a machine account for the test. # @@ -200,13 +200,13 @@ class MS_Kile_Client_Principal_Lookup_Tests(KDCBaseTest): self.assertEqual(realm.upper().encode('UTF8'), enc_part['crealm']) def test_nt_principal_step_3(self): - ''' Step 3 + """ Step 3 If not found search for a matching UPN name where the UPN is set to cname@realm or cname@DC's domain name - ''' + """ # Create a user account for the test. # samdb = self.get_samdb() @@ -264,10 +264,10 @@ class MS_Kile_Client_Principal_Lookup_Tests(KDCBaseTest): self.assertEqual(realm.upper().encode('UTF8'), enc_part['crealm']) def test_nt_principal_step_4_a(self): - ''' Step 4, no pre-authentication + """ Step 4, no pre-authentication If not found and no pre-authentication search for a matching altSecurityIdentity - ''' + """ # Create a user account for the test. # with an altSecurityIdentity, and with UF_DONT_REQUIRE_PREAUTH # set. @@ -328,10 +328,10 @@ class MS_Kile_Client_Principal_Lookup_Tests(KDCBaseTest): self.check_error_rep(rep, KDC_ERR_TGT_REVOKED) def test_nt_principal_step_4_b(self): - ''' Step 4, pre-authentication + """ Step 4, pre-authentication If not found and pre-authentication search for a matching user principal name - ''' + """ # Create user and machine accounts for the test. # @@ -396,12 +396,12 @@ class MS_Kile_Client_Principal_Lookup_Tests(KDCBaseTest): self.assertEqual(realm.upper().encode('UTF8'), enc_part['crealm']) def test_nt_principal_step_4_c(self): - ''' Step 4, pre-authentication + """ Step 4, pre-authentication If not found and pre-authentication search for a matching user principal name This test uses the altsecid, so the AS-REQ should fail. - ''' + """ # Create user and machine accounts for the test. # @@ -438,11 +438,11 @@ class MS_Kile_Client_Principal_Lookup_Tests(KDCBaseTest): self.check_error_rep(rep, KDC_ERR_C_PRINCIPAL_UNKNOWN) def test_enterprise_principal_step_1_3(self): - ''' Steps 1-3 + """ Steps 1-3 For an NT_ENTERPRISE_PRINCIPAL cname search for a user principal name matching the cname - ''' + """ # Create a user account for the test. # @@ -502,13 +502,13 @@ class MS_Kile_Client_Principal_Lookup_Tests(KDCBaseTest): self.assertEqual(realm.upper().encode('UTF8'), crealm) def test_enterprise_principal_step_4(self): - ''' Step 4 + """ Step 4 If that fails search for an account where the sAMAccountName matches the name before the @ - ''' + """ # Create a user account for the test. # @@ -567,13 +567,13 @@ class MS_Kile_Client_Principal_Lookup_Tests(KDCBaseTest): self.assertEqual(realm.upper().encode('UTF8'), crealm) def test_enterprise_principal_step_5(self): - ''' Step 5 + """ Step 5 If that fails search for an account where the sAMAccountName matches the name before the @ with a $ appended. - ''' + """ # Create a user account for the test. # @@ -633,10 +633,10 @@ class MS_Kile_Client_Principal_Lookup_Tests(KDCBaseTest): self.assertEqual(realm.upper().encode('UTF8'), crealm) def test_enterprise_principal_step_6_a(self): - ''' Step 6, no pre-authentication + """ Step 6, no pre-authentication If not found and no pre-authentication search for a matching altSecurityIdentity - ''' + """ # Create a user account for the test. # with an altSecurityIdentity, and with UF_DONT_REQUIRE_PREAUTH # set. @@ -698,10 +698,10 @@ class MS_Kile_Client_Principal_Lookup_Tests(KDCBaseTest): self.check_error_rep(rep, KDC_ERR_TGT_REVOKED) def test_nt_enterprise_principal_step_6_b(self): - ''' Step 4, pre-authentication + """ Step 4, pre-authentication If not found and pre-authentication search for a matching user principal name - ''' + """ # Create user and machine accounts for the test. # @@ -768,12 +768,12 @@ class MS_Kile_Client_Principal_Lookup_Tests(KDCBaseTest): self.assertEqual(realm.upper().encode('UTF8'), enc_part['crealm']) def test_nt_principal_step_6_c(self): - ''' Step 4, pre-authentication + """ Step 4, pre-authentication If not found and pre-authentication search for a matching user principal name This test uses the altsecid, so the AS-REQ should fail. - ''' + """ # Create user and machine accounts for the test. # diff --git a/python/samba/tests/ldap_raw.py b/python/samba/tests/ldap_raw.py index f4ea97d120e..09b61b2dc55 100644 --- a/python/samba/tests/ldap_raw.py +++ b/python/samba/tests/ldap_raw.py @@ -67,14 +67,14 @@ SET = b'\x31' # ASN.1 Helper functions. # def encode_element(ber_type, data): - ''' Encode an ASN.1 BER element. ''' + """ Encode an ASN.1 BER element. """ if data is None: return ber_type + encode_length(0) return ber_type + encode_length(len(data)) + data def encode_length(length): - ''' Encode the length of an ASN.1 BER element. ''' + """ Encode the length of an ASN.1 BER element. """ if length > 0xFFFFFF: return b'\x84' + length.to_bytes(4, "big") @@ -88,38 +88,38 @@ def encode_length(length): def encode_string(string): - ''' Encode an octet string ''' + """ Encode an octet string """ return encode_element(OCTET_STRING, string) def encode_boolean(boolean): - ''' Encode a boolean value ''' + """ Encode a boolean value """ if boolean: return encode_element(BOOLEAN, b'\xFF') return encode_element(BOOLEAN, b'\x00') def encode_integer(integer): - ''' Encode an integer value ''' + """ Encode an integer value """ bit_len = integer.bit_length() byte_len = (bit_len // 8) + 1 return encode_element(INTEGER, integer.to_bytes(byte_len, "big")) def encode_enumerated(enum): - ''' Encode an enumerated value ''' + """ Encode an enumerated value """ return encode_element(ENUMERATED, enum.to_bytes(1, "big")) def encode_sequence(sequence): - ''' Encode a sequence ''' + """ Encode a sequence """ return encode_element(SEQUENCE, sequence) def decode_element(data): - ''' + """ decode an ASN.1 element - ''' + """ if data is None: return None @@ -169,14 +169,14 @@ class RawLdapTest(TestCase): super(RawLdapTest, self).tearDown() def disconnect(self): - ''' Disconnect from and clean up the connection to the server ''' + """ Disconnect from and clean up the connection to the server """ if self.socket is None: return self.socket.close() self.socket = None def connect(self): - ''' Establish an ldaps connection to the test server ''' + """ Establish an ldaps connection to the test server """ # # Disable host name and certificate verification context = ssl.create_default_context() @@ -196,7 +196,7 @@ class RawLdapTest(TestCase): raise def send(self, req): - ''' Send the request to the server ''' + """ Send the request to the server """ try: self.socket.sendall(req) except socket.error: @@ -204,7 +204,7 @@ class RawLdapTest(TestCase): raise def recv(self, num_recv=0xffff, timeout=None): - ''' receive an array of bytes from the server ''' + """ receive an array of bytes from the server """ data = None try: if timeout is not None: @@ -225,9 +225,9 @@ class RawLdapTest(TestCase): return data def bind(self): - ''' + """ Perform a simple bind - ''' + """ user = self.user.encode('UTF8') ou = self.dns_name.replace('.', ',dc=').encode('UTF8') @@ -277,7 +277,7 @@ class RawLdapTest(TestCase): self.assertGreater(len(rest), 0) def test_decode_element(self): - ''' Tests for the decode_element method ''' + """ Tests for the decode_element method """ # Boolean true value data = b'\x01\x01\xff' @@ -338,11 +338,11 @@ class RawLdapTest(TestCase): self.assertEqual(b'\x05\x00'.hex(), rest.hex()) def test_search_equals_maximum_permitted_size(self): - ''' + """ Check that an LDAP search request equal to the maximum size is accepted This test is done on a authenticated connection so that the maximum non search request is 16MiB. - ''' + """ self.bind() # Lets build an ldap search packet to query the RootDSE @@ -428,12 +428,12 @@ class RawLdapTest(TestCase): self.assertEqual(0, len(rest)) def test_search_exceeds_maximum_permitted_size(self): - ''' + """ Test that a search query longer than the maximum permitted size is rejected. This test is done on a authenticated connection so that the maximum non search request is 16MiB. - ''' + """ self.bind() @@ -470,9 +470,9 @@ class RawLdapTest(TestCase): self.assertIsNone(data) def test_simple_anonymous_bind(self): - ''' + """ Test a simple anonymous bind - ''' + """ # Lets build an anonymous simple bind request bind = encode_integer(3) # ldap version @@ -516,12 +516,12 @@ class RawLdapTest(TestCase): self.assertGreater(len(rest), 0) def test_simple_bind_at_limit(self): - ''' + """ Test a simple bind, with a large invalid user name. As the resulting packet is equal to the maximum unauthenticated packet size we should see an INVALID_CREDENTIALS response - ''' + """ # Lets build a simple bind request bind = encode_integer(3) # ldap version @@ -569,12 +569,12 @@ class RawLdapTest(TestCase): self.assertGreater(len(rest), 0) def test_simple_bind_gt_limit(self): - ''' + """ Test a simple bind, with a large invalid user name. As the resulting packet is one greater than the maximum unauthenticated packet size we should see the connection reset. - ''' + """ # Lets build a simple bind request bind = encode_integer(3) # ldap version @@ -595,11 +595,11 @@ class RawLdapTest(TestCase): self.assertIsNone(data) def test_unauthenticated_delete_at_limit(self): - ''' + """ Test a delete, with a large invalid DN As the resulting packet is equal to the maximum unauthenticated packet size we should see an INVALID_DN_SYNTAX response - ''' + """ # Lets build a delete request, with a large invalid DN dn = b' ' * 255987 @@ -644,11 +644,11 @@ class RawLdapTest(TestCase): self.assertGreater(len(rest), 0) def test_unauthenticated_delete_gt_limit(self): - ''' + """ Test a delete, with a large invalid DN As the resulting packet is greater than the maximum unauthenticated packet size we should see a connection reset - ''' + """ # Lets build a delete request, with a large invalid DN dn = b' ' * 255988 @@ -666,11 +666,11 @@ class RawLdapTest(TestCase): self.assertIsNone(data) def test_authenticated_delete_at_limit(self): - ''' + """ Test a delete, with a large invalid DN As the resulting packet is equal to the maximum authenticated packet size we should see an INVALID_DN_SYNTAX response - ''' + """ # Lets build a delete request, with a large invalid DN dn = b' ' * 16777203 @@ -717,11 +717,11 @@ class RawLdapTest(TestCase): self.assertGreater(len(rest), 0) def test_authenticated_delete_gt_limit(self): - ''' + """ Test a delete, with a large invalid DN As the resulting packet is one greater than the maximum authenticated packet size we should see a connection reset - ''' + """ # Lets build a delete request, with a large invalid DN dn = b' ' * 16777204 @@ -763,14 +763,14 @@ class RawCldapTest(TestCase): super(RawCldapTest, self).tearDown() def disconnect(self): - ''' Disconnect from and clean up the connection to the server ''' + """ Disconnect from and clean up the connection to the server """ if self.socket is None: return self.socket.close() self.socket = None def connect(self): - ''' Establish an UDP connection to the test server ''' + """ Establish an UDP connection to the test server """ try: self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) @@ -782,7 +782,7 @@ class RawCldapTest(TestCase): raise def send(self, req): - ''' Send the request to the server ''' + """ Send the request to the server """ try: self.socket.sendall(req) except socket.error: @@ -790,7 +790,7 @@ class RawCldapTest(TestCase): raise def recv(self, num_recv=0xffff, timeout=None): - ''' receive an array of bytes from the server ''' + """ receive an array of bytes from the server """ data = None try: if timeout is not None: @@ -811,10 +811,10 @@ class RawCldapTest(TestCase): return data def test_search_equals_maximum_permitted_size(self): - ''' + """ Check that an CLDAP search request equal to the maximum size is accepted - ''' + """ # Lets build an ldap search packet to query the RootDSE header = encode_string(None) # Base DN, "" @@ -901,10 +901,10 @@ class RawCldapTest(TestCase): self.assertEqual(0, len(rest)) def test_search_exceeds_maximum_permitted_size(self): - ''' + """ Test that a cldap request longer than the maximum permitted size is rejected. - ''' + """ # Lets build an ldap search packet to query the RootDSE header = encode_string(None) # Base DN, "" diff --git a/python/samba/tests/samba_tool/group.py b/python/samba/tests/samba_tool/group.py index cee42f303d3..ed95ef6c5b1 100644 --- a/python/samba/tests/samba_tool/group.py +++ b/python/samba/tests/samba_tool/group.py @@ -575,10 +575,10 @@ template """ "Total groups not reported correctly") def _random_user(self, base=None): - ''' + """ create a user with random attribute values, you can specify base attributes - ''' + """ if base is None: base = {} user = { diff --git a/python/samba/tests/smb3unix.py b/python/samba/tests/smb3unix.py index 5a88640e1cd..6246e81d72a 100644 --- a/python/samba/tests/smb3unix.py +++ b/python/samba/tests/smb3unix.py @@ -332,9 +332,9 @@ class Smb3UnixTests(samba.tests.libsmb.LibsmbTests): self.assertEqual(0, dotdot['dev'], 'The dev for .. was not 0') def test_create_context_basic1(self): - ''' + """ Check basic CreateContexts response - ''' + """ try: c = libsmb.Conn( self.server_ip, diff --git a/source4/dsdb/tests/python/passwords.py b/source4/dsdb/tests/python/passwords.py index de69293da76..0f65028bb62 100755 --- a/source4/dsdb/tests/python/passwords.py +++ b/source4/dsdb/tests/python/passwords.py @@ -233,7 +233,7 @@ unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le')). self.assertTrue('0000052D' in msg) def test_old_password_simple_bind(self): - '''Shows that we can log in with the immediate previous password, but not any earlier passwords.''' + """Shows that we can log in with the immediate previous password, but not any earlier passwords.""" user_dn_str = f'CN=testuser,CN=Users,{self.base_dn}' user_dn = Dn(self.ldb, user_dn_str) @@ -276,7 +276,7 @@ unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le')). self.fail('should have failed to login with previous password!') def test_old_password_attempt_reuse(self): - '''Shows that we cannot reuse the original password after changing the password twice.''' + """Shows that we cannot reuse the original password after changing the password twice.""" res = self.ldb.search(self.ldb.domain_dn(), scope=SCOPE_BASE, attrs=['pwdHistoryLength']) @@ -317,7 +317,7 @@ unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le')). previous_pwd = new_pwd def test_old_password_rename_simple_bind(self): - '''Shows that we can log in with the previous password after renaming the account.''' + """Shows that we can log in with the previous password after renaming the account.""" user_dn_str = f'CN=testuser,CN=Users,{self.base_dn}' user_dn = Dn(self.ldb, user_dn_str) @@ -353,7 +353,7 @@ unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le')). self.fail('failed to login with previous password!') def test_old_password_rename_simple_bind_2(self): - '''Shows that we can rename the account, change the password and log in with the previous password.''' + """Shows that we can rename the account, change the password and log in with the previous password.""" user_dn_str = f'CN=testuser,CN=Users,{self.base_dn}' user_dn = Dn(self.ldb, user_dn_str) @@ -382,7 +382,7 @@ unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le')). self.fail('failed to login with previous password!') def test_old_password_rename_attempt_reuse(self): - '''Shows that we cannot reuse the original password after renaming the account.''' + """Shows that we cannot reuse the original password after renaming the account.""" user_dn_str = f'CN=testuser,CN=Users,{self.base_dn}' user_dn = Dn(self.ldb, user_dn_str) @@ -433,7 +433,7 @@ unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le')). self.fail('should not have been able to reuse password!') def test_old_password_rename_attempt_reuse_2(self): - '''Shows that we cannot reuse the original password after renaming the account and changing the password.''' + """Shows that we cannot reuse the original password after renaming the account and changing the password.""" user_dn_str = f'CN=testuser,CN=Users,{self.base_dn}' user_dn = Dn(self.ldb, user_dn_str) -- 2.47.3