]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
tests/krb5: Check only for the canonical representation of a security descriptor
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Mon, 27 Mar 2023 18:46:23 +0000 (07:46 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 5 Apr 2023 01:06:29 +0000 (01:06 +0000)
As of commit be1aae77b7610933b1121f207e0a4df523c2d278, Samba only
produces the canonical form of a security descriptor.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/tests/krb5/claims_tests.py

index 5cdd1f4a3617df6014fc2460a708e98909b788be..af04ed077f80adfc8ad0921d35690237b28d7de2 100755 (executable)
@@ -58,41 +58,6 @@ class UnorderedList(tuple):
         return hash(tuple(sorted(self)))
 
 
-# Use this to assert that each element of a list belongs to a set() of
-# acceptable elements.
-class OneOf(tuple):
-    def __eq__(self, other):
-        if not isinstance(other, OneOf):
-            raise AssertionError('unexpected comparison attempt')
-
-        # Lists are of different lengths, so we're trivially done.
-        if len(self) != len(other):
-            return False
-
-        # Now we know that the lists are of equal length, we can compare their
-        # elements. These can be normal elements, or set()s to allow any one of
-        # the members of the set to match.
-
-        def elem_eq(this, that):
-            if isinstance(this, set):
-                if isinstance(that, set):
-                    raise AssertionError('both sides unexpectedly sets')
-                # Is 'that' contained in the set() of acceptable values,
-                # 'this'?
-                return that in this
-
-            if isinstance(that, set):
-                # Is 'this' contained in the set() of acceptable values,
-                # 'that'?
-                return this in that
-
-            # Neither element is a set(). Compare elements directly.
-            return this == that
-
-        # Are all the elements equal?
-        return all(map(elem_eq, self, other))
-
-
 @DynamicTestCase
 class ClaimsTests(KDCBaseTest):
     # Placeholder objects that represent accounts undergoing testing.
@@ -1104,10 +1069,9 @@ class ClaimsTests(KDCBaseTest):
                     'for_classes': ['computer'],
                     'value_type': claims.CLAIM_TYPE_STRING,
                     'values': (security_descriptor,),
-                    'expected_values': OneOf([{
-                        'O:BAD:PARAI(A;OICINPIOID;CCDCLCSWRPWPDTLOCRSDRCWDWOGAGXGWGR;;;S-1-0-0)',  # Windows
-                        'O:BAD:PARAI(A;OICINPIOID;RPWPCRCCDCLCLORCWOWDSDDTSWGAGRGWGX;;;S-1-0-0)',  # Samba
-                    }]),
+                    'expected_values': (
+                        'O:BAD:PARAI(A;OICINPIOID;CCDCLCSWRPWPDTLOCRSDRCWDWOGAGXGWGR;;;S-1-0-0)',
+                    ),
                     'expected': True,
                 },
             ],