-
Notifications
You must be signed in to change notification settings - Fork 0
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
af972b4
commit 7e296a2
Showing
7 changed files
with
4 additions
and
174 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 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
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
from fastapi.testclient import TestClient | ||
from moto.dynamodb import mock_dynamodb | ||
from moto.server import ThreadedMotoServer | ||
from pytest_mock.plugin import MockerFixture, MockType | ||
from pytest_mock.plugin import MockerFixture | ||
|
||
os.environ["LINGUAPHOTO_ENVIRONMENT"] = "local" | ||
|
||
|
@@ -75,29 +75,3 @@ def app_client() -> Generator[TestClient, None, None]: | |
|
||
with TestClient(app) as app_client: | ||
yield app_client | ||
|
||
|
||
@pytest.fixture(autouse=True) | ||
def mock_send_email(mocker: MockerFixture) -> MockType: | ||
mock = mocker.patch("linguaphoto.utils.email.send_email") | ||
mock.return_value = None | ||
return mock | ||
|
||
|
||
@pytest.fixture() | ||
def authenticated_user(app_client: TestClient) -> tuple[TestClient, str, str]: | ||
from linguaphoto.utils.email import OneTimePassPayload | ||
|
||
test_email = "[email protected]" | ||
|
||
# Logs the user in using the OTP. | ||
otp = OneTimePassPayload(email=test_email, lifetime=3600) | ||
response = app_client.post("/users/otp", json={"payload": otp.encode()}) | ||
assert response.status_code == 200, response.json() | ||
|
||
# Gets a session token. | ||
response = app_client.post("/users/refresh") | ||
data = response.json() | ||
assert response.status_code == 200, data | ||
|
||
return app_client, test_email, data["token"] |