mirror of
https://github.com/arcan1s/ahriman.git
synced 2026-07-18 08:41:06 +00:00
700893ecac
* migrate to hatch * reorder tests * generic fixtures * straight forward conftest * fix docs generation * fix tox environments * reformat tomls * cleanup pyproject * some play with renaming * move root conftest into pytest plugins * fix setup script * move fixtures to __init__.py * remove duplicate fixtures * disable pylint warning * simplify configuration fixture * remove empty conftest * remove crap from local pyprojects
55 lines
1.3 KiB
Python
55 lines
1.3 KiB
Python
import pytest
|
|
|
|
from ahriman.core.auth.mapping import Mapping
|
|
from ahriman.core.auth.oauth import OAuth
|
|
from ahriman.core.auth.pam import PAM
|
|
from ahriman.core.configuration import Configuration
|
|
from ahriman.core.database import SQLite
|
|
|
|
|
|
@pytest.fixture
|
|
def mapping(configuration: Configuration, database: SQLite) -> Mapping:
|
|
"""
|
|
auth provider fixture
|
|
|
|
Args:
|
|
configuration(Configuration): configuration fixture
|
|
database(SQLite): database fixture
|
|
|
|
Returns:
|
|
Mapping: auth service instance
|
|
"""
|
|
return Mapping(configuration, database)
|
|
|
|
|
|
@pytest.fixture
|
|
def oauth(configuration: Configuration, database: SQLite) -> OAuth:
|
|
"""
|
|
OAuth provider fixture
|
|
|
|
Args:
|
|
configuration(Configuration): configuration fixture
|
|
database(SQLite): database fixture
|
|
|
|
Returns:
|
|
OAuth: OAuth2 service instance
|
|
"""
|
|
configuration.set("web", "address", "https://example.com")
|
|
return OAuth(configuration, database)
|
|
|
|
|
|
@pytest.fixture
|
|
def pam(configuration: Configuration, database: SQLite) -> PAM:
|
|
"""
|
|
PAM provider fixture
|
|
|
|
Args:
|
|
configuration(Configuration): configuration fixture
|
|
database(SQLite): database fixture
|
|
|
|
Returns:
|
|
PAM: PAM service instance
|
|
"""
|
|
configuration.set_option("auth", "full_access_group", "wheel")
|
|
return PAM(configuration, database)
|