generated from MinBZK/python-project-template
-
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.
Bring code coverage back up and change pre-commit
- Loading branch information
Showing
15 changed files
with
409 additions
and
116 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import pytest | ||
from httpx import AsyncClient | ||
from pytest_mock import MockerFixture | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_auth_profile(client: AsyncClient, mocker: MockerFixture) -> None: | ||
mocker.patch("amt.api.routes.auth.get_user", return_value="test_user_for_auth_profile") | ||
response = await client.get("/auth/profile") | ||
|
||
assert b"https://gravatar.com/" in response.content |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import pytest | ||
from amt.core.authorization import get_user | ||
from pytest_mock import MockerFixture | ||
|
||
|
||
@pytest.mark.asyncio | ||
def test_get_user(mocker: MockerFixture) -> None: | ||
mock_request = mocker.Mock(scope=["session"]) | ||
mock_request.session = {"user": {"name": "user"}} | ||
mock_get_requested_language = mocker.patch("amt.core.authorization.get_requested_language", return_value="nl") | ||
user = get_user(mock_request) | ||
assert user == {"name": "user", "locale": "nl"} | ||
mock_get_requested_language.assert_called_once_with(mock_request) |
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
Oops, something went wrong.