Skip to content

Commit 247c7d2

Browse files
[AAP-45394] Fix black formatting in regression tests
Use single quotes and inline assertions to match the project's black==25.1.0 + skip-string-normalization configuration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2e8a4d4 commit 247c7d2

1 file changed

Lines changed: 22 additions & 28 deletions

File tree

test_app/tests/authentication/utils/test_claims.py

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2740,23 +2740,21 @@ def test_create_claims_deny_all_then_allow_override(
27402740
access remained denied.
27412741
"""
27422742
# order=1: deny-all rule (trigger 'never' -> has_permission=False)
2743-
local_authenticator_map.map_type = "allow"
2744-
local_authenticator_map.triggers = {"never": {}}
2743+
local_authenticator_map.map_type = 'allow'
2744+
local_authenticator_map.triggers = {'never': {}}
27452745
local_authenticator_map.order = 1
27462746
local_authenticator_map.save()
27472747

27482748
# order=2: allow-always rule (trigger 'always' -> has_permission=True)
2749-
local_authenticator_map_1.map_type = "allow"
2750-
local_authenticator_map_1.triggers = {"always": {}}
2749+
local_authenticator_map_1.map_type = 'allow'
2750+
local_authenticator_map_1.triggers = {'always': {}}
27512751
local_authenticator_map_1.order = 2
27522752
local_authenticator_map_1.save()
27532753

27542754
authenticator = local_authenticator_map.authenticator
2755-
res = claims.create_claims(authenticator, "username", {}, [])
2755+
res = claims.create_claims(authenticator, 'username', {}, [])
27562756

2757-
assert res["access_allowed"] is True, (
2758-
"An allow-always map at order=2 must override a deny-all map at order=1 (AAP-45394)"
2759-
)
2757+
assert res['access_allowed'] is True, 'An allow-always map at order=2 must override a deny-all map at order=1 (AAP-45394)'
27602758

27612759

27622760
def test_create_claims_deny_all_not_overridden_without_match(
@@ -2768,24 +2766,22 @@ def test_create_claims_deny_all_not_overridden_without_match(
27682766
allow map's trigger, access must remain denied.
27692767
"""
27702768
# order=1: deny-all
2771-
local_authenticator_map.map_type = "allow"
2772-
local_authenticator_map.triggers = {"never": {}}
2769+
local_authenticator_map.map_type = 'allow'
2770+
local_authenticator_map.triggers = {'never': {}}
27732771
local_authenticator_map.order = 1
27742772
local_authenticator_map.save()
27752773

2776-
# order=2: allow only for members of group "special-group"; user has no groups
2777-
local_authenticator_map_1.map_type = "allow"
2778-
local_authenticator_map_1.triggers = {"groups": {"has_or": ["special-group"]}}
2774+
# order=2: allow only for members of group 'special-group'; user has no groups
2775+
local_authenticator_map_1.map_type = 'allow'
2776+
local_authenticator_map_1.triggers = {'groups': {'has_or': ['special-group']}}
27792777
local_authenticator_map_1.order = 2
27802778
local_authenticator_map_1.save()
27812779

27822780
authenticator = local_authenticator_map.authenticator
2783-
# Pass an empty groups list the user is NOT in "special-group"
2784-
res = claims.create_claims(authenticator, "username", {}, [])
2781+
# Pass an empty groups list -- the user is NOT in 'special-group'
2782+
res = claims.create_claims(authenticator, 'username', {}, [])
27852783

2786-
assert res["access_allowed"] is False, (
2787-
"User not matching the second allow map must remain denied (AAP-45394)"
2788-
)
2784+
assert res['access_allowed'] is False, 'User not matching the second allow map must remain denied (AAP-45394)'
27892785

27902786

27912787
def test_create_claims_deny_all_overridden_with_group_match(
@@ -2797,21 +2793,19 @@ def test_create_claims_deny_all_overridden_with_group_match(
27972793
map's trigger, the deny from the first map must be overridden.
27982794
"""
27992795
# order=1: deny-all
2800-
local_authenticator_map.map_type = "allow"
2801-
local_authenticator_map.triggers = {"never": {}}
2796+
local_authenticator_map.map_type = 'allow'
2797+
local_authenticator_map.triggers = {'never': {}}
28022798
local_authenticator_map.order = 1
28032799
local_authenticator_map.save()
28042800

2805-
# order=2: allow for members of "special-group"
2806-
local_authenticator_map_1.map_type = "allow"
2807-
local_authenticator_map_1.triggers = {"groups": {"has_or": ["special-group"]}}
2801+
# order=2: allow for members of 'special-group'
2802+
local_authenticator_map_1.map_type = 'allow'
2803+
local_authenticator_map_1.triggers = {'groups': {'has_or': ['special-group']}}
28082804
local_authenticator_map_1.order = 2
28092805
local_authenticator_map_1.save()
28102806

28112807
authenticator = local_authenticator_map.authenticator
2812-
# Pass "special-group" in the groups list the user IS in the group
2813-
res = claims.create_claims(authenticator, "username", {}, ["special-group"])
2808+
# Pass 'special-group' in the groups list -- the user IS in the group
2809+
res = claims.create_claims(authenticator, 'username', {}, ['special-group'])
28142810

2815-
assert res["access_allowed"] is True, (
2816-
"User matching the second allow map must have access granted despite earlier deny (AAP-45394)"
2817-
)
2811+
assert res['access_allowed'] is True, 'User matching the second allow map must have access granted despite earlier deny (AAP-45394)'

0 commit comments

Comments
 (0)