mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-07-29 21:59:55 +00:00
refactor: fix pylint warnings in tests
This commit is contained in:
@ -73,7 +73,7 @@ def request(application: Application, path: str, method: str, params: Any = None
|
||||
request_mock.match_info = UrlMappingMatchInfo({}, route_mock)
|
||||
|
||||
extra = extra or {}
|
||||
request_mock.get_extra_info.side_effect = lambda key: extra.get(key)
|
||||
request_mock.get_extra_info.side_effect = extra.get
|
||||
|
||||
return request_mock
|
||||
|
||||
@ -167,14 +167,13 @@ def application_with_auth(configuration: Configuration, user: User, spawner: Spa
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def application_with_debug(configuration: Configuration, user: User, spawner: Spawn, database: SQLite,
|
||||
def application_with_debug(configuration: Configuration, spawner: Spawn, database: SQLite,
|
||||
mocker: MockerFixture) -> Application:
|
||||
"""
|
||||
application fixture with debug enabled
|
||||
|
||||
Args:
|
||||
configuration(Configuration): configuration fixture
|
||||
user(User): user descriptor fixture
|
||||
spawner(Spawn): spawner fixture
|
||||
database(SQLite): database fixture
|
||||
mocker(MockerFixture): mocker object
|
||||
|
@ -3,19 +3,17 @@ import pytest
|
||||
from ahriman.core.auth import Auth
|
||||
from ahriman.core.configuration import Configuration
|
||||
from ahriman.core.database import SQLite
|
||||
from ahriman.models.user import User
|
||||
from ahriman.web.middlewares.auth_handler import _AuthorizationPolicy
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def authorization_policy(configuration: Configuration, database: SQLite, user: User) -> _AuthorizationPolicy:
|
||||
def authorization_policy(configuration: Configuration, database: SQLite) -> _AuthorizationPolicy:
|
||||
"""
|
||||
fixture for authorization policy
|
||||
|
||||
Args:
|
||||
configuration(Configuration): configuration fixture
|
||||
database(SQLite): database fixture
|
||||
user(User): user fixture
|
||||
|
||||
Returns:
|
||||
AuthorizationPolicy: authorization policy fixture
|
||||
|
@ -24,7 +24,7 @@ async def test_authorized_userid(authorization_policy: _AuthorizationPolicy, use
|
||||
assert await authorization_policy.authorized_userid(user.username) == user.username
|
||||
|
||||
|
||||
async def test_authorized_userid_unknown(authorization_policy: _AuthorizationPolicy, user: User) -> None:
|
||||
async def test_authorized_userid_unknown(authorization_policy: _AuthorizationPolicy) -> None:
|
||||
"""
|
||||
must not allow unknown user id for authorization
|
||||
"""
|
||||
@ -51,7 +51,7 @@ async def test_permits(authorization_policy: _AuthorizationPolicy, user: User) -
|
||||
])
|
||||
|
||||
|
||||
async def test_auth_handler_unix_socket(client_with_auth: TestClient, mocker: MockerFixture) -> None:
|
||||
async def test_auth_handler_unix_socket(mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must allow calls via unix sockets
|
||||
"""
|
||||
|
Reference in New Issue
Block a user