-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* roles integration for groups handler * added dummy handler for groups * closes inveniosoftware/invenio-app-rdm#2186 Co-authored-by: jrcastro2 <[email protected]>
- Loading branch information
Showing
6 changed files
with
79 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,12 +37,21 @@ def test_authorized_signup_handler(remote, app, models_fixture): | |
"""Test authorized signup handler.""" | ||
datastore = app.extensions["invenio-accounts"].datastore | ||
user = datastore.find_user(email="[email protected]") | ||
existing_email = "[email protected]" | ||
|
||
example_response = {"access_token": "test_access_token"} | ||
example_account_info = { | ||
"user": { | ||
"email": existing_email, | ||
}, | ||
"external_id": "1234", | ||
"external_method": "test_method", | ||
} | ||
|
||
# Mock remote app's handler | ||
current_oauthclient.signup_handlers[remote.name] = { | ||
"setup": lambda token, resp: None | ||
"setup": lambda token, resp: None, | ||
"info": lambda resp: example_account_info, | ||
} | ||
|
||
# Authenticate user | ||
|
@@ -67,9 +76,9 @@ def test_unauthorized_signup(remote, app, models_fixture): | |
example_account_info = { | ||
"user": { | ||
"email": existing_email, | ||
"external_id": "1234", | ||
"external_method": "test_method", | ||
} | ||
}, | ||
"external_id": "1234", | ||
"external_method": "test_method", | ||
} | ||
|
||
# Mock remote app's handler | ||
|
@@ -81,9 +90,8 @@ def test_unauthorized_signup(remote, app, models_fixture): | |
_security.login_without_confirmation = False | ||
user.confirmed_at = None | ||
app.config["OAUTHCLIENT_REMOTE_APPS"][remote.name] = {} | ||
|
||
resp = authorized_signup_handler(example_response, remote) | ||
check_redirect_location(resp, lambda x: x.startswith("/login/")) | ||
check_redirect_location(resp, lambda x: x.startswith("/login")) | ||
|
||
|
||
def test_signup_handler(remote, app, models_fixture): | ||
|