Compare commits

..

2 Commits

Author SHA1 Message Date
bfb51434a0 initial impl 2026-03-18 16:53:25 +02:00
a04b6c3b9c refactor: move package archive lockup to package info trait 2026-03-15 20:23:20 +02:00
2 changed files with 14 additions and 17 deletions

View File

@@ -127,7 +127,6 @@ def application(configuration: Configuration, spawner: Spawn, database: SQLite,
Application: application test instance Application: application test instance
""" """
configuration.set_option("web", "port", "8080") configuration.set_option("web", "port", "8080")
mocker.patch("ahriman.core.configuration.Configuration.from_path", return_value=configuration)
mocker.patch("ahriman.core.database.SQLite.load", return_value=database) mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
mocker.patch("aiohttp_apispec.setup_aiohttp_apispec") mocker.patch("aiohttp_apispec.setup_aiohttp_apispec")
mocker.patch.object(helpers, "aiohttp_security", None) mocker.patch.object(helpers, "aiohttp_security", None)
@@ -154,7 +153,6 @@ def application_with_auth(configuration: Configuration, user: User, spawner: Spa
""" """
configuration.set_option("auth", "target", "configuration") configuration.set_option("auth", "target", "configuration")
configuration.set_option("web", "port", "8080") configuration.set_option("web", "port", "8080")
mocker.patch("ahriman.core.configuration.Configuration.from_path", return_value=configuration)
mocker.patch("ahriman.core.database.SQLite.load", return_value=database) mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
mocker.patch("aiohttp_apispec.setup_aiohttp_apispec") mocker.patch("aiohttp_apispec.setup_aiohttp_apispec")
_, repository_id = configuration.check_loaded() _, repository_id = configuration.check_loaded()

View File

@@ -61,21 +61,6 @@ def test_create_socket_safe(application: Application, mocker: MockerFixture) ->
chmod_mock.assert_not_called() chmod_mock.assert_not_called()
def test_create_watcher(configuration: Configuration, mocker: MockerFixture) -> None:
"""
must create watcher for repository
"""
mocker.patch("ahriman.core.configuration.Configuration.from_path", return_value=configuration)
database_mock = mocker.patch("ahriman.core.database.SQLite.load")
client_mock = mocker.patch("ahriman.core.status.Client.load")
configuration_path, repository_id = configuration.check_loaded()
result = _create_watcher(configuration_path, repository_id)
assert isinstance(result, Watcher)
database_mock.assert_called_once()
client_mock.assert_called_once()
async def test_on_shutdown(application: Application, mocker: MockerFixture) -> None: async def test_on_shutdown(application: Application, mocker: MockerFixture) -> None:
""" """
must write information to log must write information to log
@@ -154,6 +139,20 @@ def test_run_with_socket(application: Application, mocker: MockerFixture) -> Non
) )
def test_create_watcher(configuration: Configuration, mocker: MockerFixture) -> None:
"""
must create watcher for repository
"""
database_mock = mocker.patch("ahriman.core.database.SQLite.load")
client_mock = mocker.patch("ahriman.core.status.Client.load")
configuration_path, repository_id = configuration.check_loaded()
result = _create_watcher(configuration_path, repository_id)
assert isinstance(result, Watcher)
database_mock.assert_called_once()
client_mock.assert_called_once()
def test_setup_no_repositories(configuration: Configuration, spawner: Spawn) -> None: def test_setup_no_repositories(configuration: Configuration, spawner: Spawn) -> None:
""" """
must raise InitializeError if no repositories set must raise InitializeError if no repositories set