mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-04-28 17:27:17 +00:00
* migrate docstrings from reST to google format * add raises note Also change behaviour of the `from_option` method to fallback to disabled instead of raising exception on unknown option * fix part of warnings for sphinx * make identation a bit more readable * review fixes * add verbose description for properties to make them parsed by sphinx extenstion * add demo sphinx generator
27 lines
838 B
Python
27 lines
838 B
Python
import pytest
|
|
|
|
from ahriman.core.auth.auth import Auth
|
|
from ahriman.core.configuration import Configuration
|
|
from ahriman.core.database.sqlite 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:
|
|
"""
|
|
fixture for authorization policy
|
|
|
|
Args:
|
|
configuration(Configuration): configuration fixture
|
|
database(SQLite): database fixture
|
|
user(User): user fixture
|
|
|
|
Returns:
|
|
AuthorizationPolicy: authorization policy fixture
|
|
"""
|
|
configuration.set_option("auth", "target", "configuration")
|
|
validator = Auth.load(configuration, database)
|
|
policy = AuthorizationPolicy(validator)
|
|
return policy
|