mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-09-14 12:49:56 +00:00
strict test checks
This commit is contained in:
@ -14,7 +14,7 @@ from ahriman.web.middlewares.auth_handler import auth_handler, AuthorizationPoli
|
||||
def _identity(username: str) -> str:
|
||||
"""
|
||||
generate identity from user
|
||||
:param user: user fixture object
|
||||
:param username: name of the user
|
||||
:return: user identity string
|
||||
"""
|
||||
return f"{username} {UserIdentity.expire_when(60)}"
|
||||
@ -119,7 +119,7 @@ def test_setup_auth(application_with_auth: web.Application, auth: Auth, mocker:
|
||||
"""
|
||||
must setup authorization
|
||||
"""
|
||||
aiohttp_security_setup_mock = mocker.patch("aiohttp_security.setup")
|
||||
setup_mock = mocker.patch("aiohttp_security.setup")
|
||||
application = setup_auth(application_with_auth, auth)
|
||||
assert application.get("validator") is not None
|
||||
aiohttp_security_setup_mock.assert_called_once()
|
||||
setup_mock.assert_called_once_with(application_with_auth, pytest.helpers.anyvar(int), pytest.helpers.anyvar(int))
|
||||
|
@ -71,7 +71,7 @@ async def test_exception_handler_server_error(mocker: MockerFixture) -> None:
|
||||
handler = exception_handler(logging.getLogger())
|
||||
response = await handler(request, request_handler)
|
||||
assert _extract_body(response) == {"error": HTTPInternalServerError().reason}
|
||||
logging_mock.assert_called_once()
|
||||
logging_mock.assert_called_once() # we do not check logging arguments
|
||||
|
||||
|
||||
async def test_exception_handler_unknown_error(mocker: MockerFixture) -> None:
|
||||
@ -85,4 +85,4 @@ async def test_exception_handler_unknown_error(mocker: MockerFixture) -> None:
|
||||
handler = exception_handler(logging.getLogger())
|
||||
response = await handler(request, request_handler)
|
||||
assert _extract_body(response) == {"error": "An error"}
|
||||
logging_mock.assert_called_once()
|
||||
logging_mock.assert_called_once() # we do not check logging arguments
|
||||
|
Reference in New Issue
Block a user