-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Magic Auth and Email Verification response returns User Response instead of MagicAuthChallenge Response * Replace other magic_auth_challenge_id references
- Loading branch information
1 parent
9d32ada
commit 800fbb9
Showing
3 changed files
with
23 additions
and
45 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 |
---|---|---|
|
@@ -208,7 +208,7 @@ def test_authenticate_with_magic_auth( | |
): | ||
code = "test_auth" | ||
expires_in = 3600 | ||
magic_auth_challenge_id = "magic_auth_challenge_id" | ||
user = "user_01H7ZGXFP5C6BBQY6Z7277ZCT0" | ||
user_agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36" | ||
ip_address = "192.0.0.1" | ||
|
||
|
@@ -217,7 +217,7 @@ def test_authenticate_with_magic_auth( | |
response = self.users.authenticate_with_magic_auth( | ||
code=code, | ||
expires_in=expires_in, | ||
magic_auth_challenge_id=magic_auth_challenge_id, | ||
user=user, | ||
user_agent=user_agent, | ||
ip_address=ip_address, | ||
) | ||
|
@@ -228,7 +228,7 @@ def test_authenticate_with_magic_auth( | |
assert request["json"]["code"] == code | ||
assert request["json"]["user_agent"] == user_agent | ||
assert request["json"]["expires_in"] == expires_in | ||
assert request["json"]["magic_auth_challenge_id"] == magic_auth_challenge_id | ||
assert request["json"]["user_id"] == user | ||
assert request["json"]["ip_address"] == ip_address | ||
assert request["json"]["client_id"] == "client_b27needthisforssotemxo" | ||
assert request["json"]["client_secret"] == "sk_abdsomecharactersm284" | ||
|
@@ -331,46 +331,38 @@ def test_complete_password_reset(self, capture_and_mock_request, mock_user): | |
assert request["json"]["token"] == token | ||
assert request["json"]["new_password"] == new_password | ||
|
||
def test_send_verification_email( | ||
self, capture_and_mock_request, mock_magic_auth_challenge_response | ||
): | ||
def test_send_verification_email(self, capture_and_mock_request, mock_user): | ||
user = "user_01H7ZGXFP5C6BBQY6Z7277ZCT0" | ||
|
||
url, _ = capture_and_mock_request( | ||
"post", mock_magic_auth_challenge_response, 200 | ||
) | ||
url, _ = capture_and_mock_request("post", mock_user, 200) | ||
|
||
response = self.users.send_verification_email(user=user) | ||
|
||
assert url[0].endswith( | ||
"users/user_01H7ZGXFP5C6BBQY6Z7277ZCT0/send_verification_email" | ||
) | ||
assert response["id"] == "auth_challenge_01E4ZCR3C56J083X43JQXF3JK5" | ||
assert response["id"] == "user_01H7ZGXFP5C6BBQY6Z7277ZCT0" | ||
|
||
def test_verify_email(self, capture_and_mock_request, mock_user): | ||
magic_auth_challenge_id = "auth_challenge_123" | ||
user = "user_01H7ZGXFP5C6BBQY6Z7277ZCT0" | ||
code = "code_123" | ||
|
||
url, _ = capture_and_mock_request("post", mock_user, 200) | ||
url, request = capture_and_mock_request("post", mock_user, 200) | ||
|
||
response = self.users.verify_email( | ||
magic_auth_challenge_id=magic_auth_challenge_id, code=code | ||
) | ||
response = self.users.verify_email(user=user, code=code) | ||
|
||
assert url[0].endswith("users/verify_email") | ||
assert request["json"]["user_id"] == user | ||
assert request["json"]["code"] == code | ||
assert response["id"] == "user_01H7ZGXFP5C6BBQY6Z7277ZCT0" | ||
|
||
def test_send_magic_auth_code( | ||
self, capture_and_mock_request, mock_magic_auth_challenge_response | ||
): | ||
def test_send_magic_auth_code(self, capture_and_mock_request, mock_user): | ||
email = "[email protected]" | ||
|
||
url, request = capture_and_mock_request( | ||
"post", mock_magic_auth_challenge_response, 200 | ||
) | ||
url, request = capture_and_mock_request("post", mock_user, 200) | ||
|
||
response = self.users.send_magic_auth_code(email=email) | ||
|
||
assert url[0].endswith("users/magic_auth/send") | ||
assert request["json"]["email_address"] == email | ||
assert response["id"] == "auth_challenge_01E4ZCR3C56J083X43JQXF3JK5" | ||
assert response["id"] == "user_01H7ZGXFP5C6BBQY6Z7277ZCT0" |
This file was deleted.
Oops, something went wrong.
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