-
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.
- Loading branch information
1 parent
65d8130
commit 549c858
Showing
6 changed files
with
8 additions
and
206 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 |
---|---|---|
|
@@ -215,7 +215,6 @@ def test_authenticate_with_magic_auth( | |
self, capture_and_mock_request, mock_auth_response | ||
): | ||
code = "test_auth" | ||
expires_in = 3600 | ||
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" | ||
|
@@ -224,18 +223,15 @@ def test_authenticate_with_magic_auth( | |
|
||
response = self.users.authenticate_with_magic_auth( | ||
code=code, | ||
expires_in=expires_in, | ||
user=user, | ||
user_agent=user_agent, | ||
ip_address=ip_address, | ||
) | ||
|
||
assert url[0].endswith("users/session/token") | ||
assert url[0].endswith("users/authenticate") | ||
assert response["user"]["id"] == "user_01H7ZGXFP5C6BBQY6Z7277ZCT0" | ||
assert response["session"]["id"] == "session_01E4ZCR3C56J083X43JQXF3JK5" | ||
assert request["json"]["code"] == code | ||
assert request["json"]["user_agent"] == user_agent | ||
assert request["json"]["expires_in"] == expires_in | ||
assert request["json"]["user_id"] == user | ||
assert request["json"]["ip_address"] == ip_address | ||
assert request["json"]["client_id"] == "client_b27needthisforssotemxo" | ||
|
@@ -250,7 +246,6 @@ def test_authenticate_with_password( | |
): | ||
email = "[email protected]" | ||
password = "test123" | ||
expires_in = 3600 | ||
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" | ||
|
||
|
@@ -259,44 +254,37 @@ def test_authenticate_with_password( | |
response = self.users.authenticate_with_password( | ||
email=email, | ||
password=password, | ||
expires_in=expires_in, | ||
user_agent=user_agent, | ||
ip_address=ip_address, | ||
) | ||
|
||
assert url[0].endswith("users/session/token") | ||
assert url[0].endswith("users/authenticate") | ||
assert response["user"]["id"] == "user_01H7ZGXFP5C6BBQY6Z7277ZCT0" | ||
assert response["session"]["id"] == "session_01E4ZCR3C56J083X43JQXF3JK5" | ||
assert request["json"]["email"] == email | ||
assert request["json"]["password"] == password | ||
assert request["json"]["user_agent"] == user_agent | ||
assert request["json"]["expires_in"] == expires_in | ||
assert request["json"]["ip_address"] == ip_address | ||
assert request["json"]["client_id"] == "client_b27needthisforssotemxo" | ||
assert request["json"]["client_secret"] == "sk_abdsomecharactersm284" | ||
assert request["json"]["grant_type"] == "password" | ||
|
||
def test_authenticate_with_code(self, capture_and_mock_request, mock_auth_response): | ||
code = "test_code" | ||
expires_in = 3600 | ||
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" | ||
|
||
url, request = capture_and_mock_request("post", mock_auth_response, 200) | ||
|
||
response = self.users.authenticate_with_code( | ||
code=code, | ||
expires_in=expires_in, | ||
user_agent=user_agent, | ||
ip_address=ip_address, | ||
) | ||
|
||
assert url[0].endswith("users/session/token") | ||
assert url[0].endswith("users/authenticate") | ||
assert response["user"]["id"] == "user_01H7ZGXFP5C6BBQY6Z7277ZCT0" | ||
assert response["session"]["id"] == "session_01E4ZCR3C56J083X43JQXF3JK5" | ||
assert request["json"]["code"] == code | ||
assert request["json"]["user_agent"] == user_agent | ||
assert request["json"]["expires_in"] == expires_in | ||
assert request["json"]["ip_address"] == ip_address | ||
assert request["json"]["client_id"] == "client_b27needthisforssotemxo" | ||
assert request["json"]["client_secret"] == "sk_abdsomecharactersm284" | ||
|
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 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
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