-
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix signup_by_email * update test_signup * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Anthony Hivert <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
349fee9
commit 91c7c3c
Showing
2 changed files
with
26 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,23 +3,38 @@ | |
import pytest | ||
import responses | ||
|
||
from tgtg import BASE_URL, SIGNUP_BY_EMAIL_ENDPOINT, TgtgClient | ||
from tgtg import AUTH_POLLING_ENDPOINT, BASE_URL, SIGNUP_BY_EMAIL_ENDPOINT, TgtgClient | ||
from tgtg.exceptions import TgtgAPIError | ||
|
||
|
||
def test_signup_ok(): | ||
responses.add( | ||
responses.POST, | ||
urljoin(BASE_URL, AUTH_POLLING_ENDPOINT), | ||
json={ | ||
"access_token": "an_access_token", | ||
"refresh_token": "a_refresh_token", | ||
"startup_data": {"user": {"user_id": 1234}}, | ||
}, | ||
status=200, | ||
adding_headers={"set-cookie": "sweet sweet cookie"}, | ||
) | ||
responses.add( | ||
responses.POST, | ||
urljoin(BASE_URL, AUTH_POLLING_ENDPOINT), | ||
status=202, | ||
) | ||
responses.add( | ||
responses.POST, | ||
urljoin(BASE_URL, SIGNUP_BY_EMAIL_ENDPOINT), | ||
json={ | ||
"login_response": { | ||
"access_token": "an_access_token", | ||
"refresh_token": "a_refresh_token", | ||
} | ||
"state": "WAIT", | ||
"polling_id": "a_polling_id", | ||
}, | ||
status=200, | ||
) | ||
client = TgtgClient().signup_by_email(email="[email protected]") | ||
client = TgtgClient() | ||
client.signup_by_email(email="[email protected]") | ||
assert client.access_token == "an_access_token" | ||
assert client.refresh_token == "a_refresh_token" | ||
|
||
|
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