mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-07-16 15:29:56 +00:00
write patches via gitremote push trigger (#79)
* write patches via gitremote push trigger * implement context variables intead of custom database class
This commit is contained in:
@ -10,6 +10,7 @@ from ahriman.core.alpm.pacman import Pacman
|
||||
from ahriman.core.auth import Auth
|
||||
from ahriman.core.configuration import Configuration
|
||||
from ahriman.core.database import SQLite
|
||||
from ahriman.core.repository import Repository
|
||||
from ahriman.core.spawn import Spawn
|
||||
from ahriman.core.status.watcher import Watcher
|
||||
from ahriman.models.aur_package import AURPackage
|
||||
@ -388,6 +389,24 @@ def remote_source() -> RemoteSource:
|
||||
return RemoteSource.from_source(PackageSource.AUR, "ahriman", "aur")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def repository(configuration: Configuration, database: SQLite, mocker: MockerFixture) -> Repository:
|
||||
"""
|
||||
fixture for repository
|
||||
|
||||
Args:
|
||||
configuration(Configuration): configuration fixture
|
||||
database(SQLite): database fixture
|
||||
mocker(MockerFixture): mocker object
|
||||
|
||||
Returns:
|
||||
Repository: repository test instance
|
||||
"""
|
||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
||||
mocker.patch("ahriman.core.repository.Repository._set_context")
|
||||
return Repository.load("x86_64", configuration, database, report=False, unsafe=False)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def repository_paths(configuration: Configuration) -> RepositoryPaths:
|
||||
"""
|
||||
@ -444,17 +463,18 @@ def user() -> User:
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def watcher(configuration: Configuration, database: SQLite, mocker: MockerFixture) -> Watcher:
|
||||
def watcher(configuration: Configuration, database: SQLite, repository: Repository, mocker: MockerFixture) -> Watcher:
|
||||
"""
|
||||
package status watcher fixture
|
||||
|
||||
Args:
|
||||
configuration(Configuration): configuration fixture
|
||||
database(SQLite): database fixture
|
||||
repository(Repository): repository fixture
|
||||
mocker(MockerFixture): mocker object
|
||||
|
||||
Returns:
|
||||
Watcher: package status watcher test instance
|
||||
"""
|
||||
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
|
||||
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
|
||||
return Watcher("x86_64", configuration, database)
|
||||
|
Reference in New Issue
Block a user