-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #758 from consideRatio/pr/groups-tests
Various fixes for allowed_groups and admin_groups
- Loading branch information
Showing
18 changed files
with
615 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ def user_model(): | |
return { | ||
"email": "[email protected]", | ||
"name": "user1", | ||
"groups": ["group1"], | ||
} | ||
|
||
|
||
|
@@ -62,6 +63,47 @@ def user_model(): | |
True, | ||
True, | ||
), | ||
# common tests with allowed_groups and manage_groups | ||
( | ||
"20", | ||
{ | ||
"allowed_groups": {"group1"}, | ||
"auth_state_groups_key": "auth0_user.groups", | ||
"manage_groups": True, | ||
}, | ||
True, | ||
None, | ||
), | ||
( | ||
"21", | ||
{ | ||
"allowed_groups": {"test-user-not-in-group"}, | ||
"auth_state_groups_key": "auth0_user.groups", | ||
"manage_groups": True, | ||
}, | ||
False, | ||
None, | ||
), | ||
( | ||
"22", | ||
{ | ||
"admin_groups": {"group1"}, | ||
"auth_state_groups_key": "auth0_user.groups", | ||
"manage_groups": True, | ||
}, | ||
True, | ||
True, | ||
), | ||
( | ||
"23", | ||
{ | ||
"admin_groups": {"test-user-not-in-group"}, | ||
"auth_state_groups_key": "auth0_user.groups", | ||
"manage_groups": True, | ||
}, | ||
False, | ||
False, | ||
), | ||
], | ||
) | ||
async def test_auth0( | ||
|
@@ -84,7 +126,10 @@ async def test_auth0( | |
|
||
if expect_allowed: | ||
assert auth_model | ||
assert set(auth_model) == {"name", "admin", "auth_state"} | ||
if authenticator.manage_groups: | ||
assert set(auth_model) == {"name", "admin", "auth_state", "groups"} | ||
else: | ||
assert set(auth_model) == {"name", "admin", "auth_state"} | ||
assert auth_model["admin"] == expect_admin | ||
auth_state = auth_model["auth_state"] | ||
assert json.dumps(auth_state) | ||
|
Oops, something went wrong.