mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-04-24 15:27:17 +00:00
* add support of remote task tracking * add remote call trigger implementation * docs update * add cross-service upload * add notes about user * add more ability to control upload * multipart upload with signatures as well as safe file save * configuration reference update * rename watcher methods * erase logs based on current package version Old implementation has used process id instead, but it leads to log removal in case of remote process trigger * add --server flag for setup command * restore behavior of the httploghandler
69 lines
1.9 KiB
Python
69 lines
1.9 KiB
Python
import argparse
|
|
import pytest
|
|
|
|
from pytest_mock import MockerFixture
|
|
|
|
from ahriman.application.ahriman import _parser
|
|
from ahriman.application.application import Application
|
|
from ahriman.application.lock import Lock
|
|
from ahriman.core.configuration import Configuration
|
|
from ahriman.core.database import SQLite
|
|
from ahriman.core.repository import Repository
|
|
|
|
|
|
@pytest.fixture
|
|
def application(configuration: Configuration, repository: Repository, database: SQLite,
|
|
mocker: MockerFixture) -> Application:
|
|
"""
|
|
fixture for application
|
|
|
|
Args:
|
|
configuration(Configuration): configuration fixture
|
|
database(SQLite): database fixture
|
|
repository(Repository): repository fixture
|
|
mocker(MockerFixture): mocker object
|
|
|
|
Returns:
|
|
Application: application test instance
|
|
"""
|
|
mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
|
|
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
|
return Application("x86_64", configuration, report=False)
|
|
|
|
|
|
@pytest.fixture
|
|
def args() -> argparse.Namespace:
|
|
"""
|
|
fixture for command line arguments
|
|
|
|
Returns:
|
|
argparse.Namespace: command line arguments test instance
|
|
"""
|
|
return argparse.Namespace(architecture=None, lock=None, force=False, unsafe=False, report=False, wait_timeout=-1)
|
|
|
|
|
|
@pytest.fixture
|
|
def lock(args: argparse.Namespace, configuration: Configuration) -> Lock:
|
|
"""
|
|
fixture for file lock
|
|
|
|
Args:
|
|
args(argparse.Namespace): command line arguments fixture
|
|
configuration(Configuration): configuration fixture
|
|
|
|
Returns:
|
|
Lock: file lock test instance
|
|
"""
|
|
return Lock(args, "x86_64", configuration)
|
|
|
|
|
|
@pytest.fixture
|
|
def parser() -> argparse.ArgumentParser:
|
|
"""
|
|
fixture for command line arguments parser
|
|
|
|
Returns:
|
|
argparse.ArgumentParser: command line arguments parser test instance
|
|
"""
|
|
return _parser()
|