mirror of
https://github.com/arcan1s/ahriman.git
synced 2026-04-07 02:53:38 +00:00
Compare commits
2 Commits
1f4d2a50b1
...
bfb51434a0
| Author | SHA1 | Date | |
|---|---|---|---|
| bfb51434a0 | |||
| a04b6c3b9c |
@@ -127,7 +127,6 @@ def application(configuration: Configuration, spawner: Spawn, database: SQLite,
|
||||
Application: application test instance
|
||||
"""
|
||||
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("aiohttp_apispec.setup_aiohttp_apispec")
|
||||
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("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("aiohttp_apispec.setup_aiohttp_apispec")
|
||||
_, repository_id = configuration.check_loaded()
|
||||
|
||||
@@ -61,21 +61,6 @@ def test_create_socket_safe(application: Application, mocker: MockerFixture) ->
|
||||
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:
|
||||
"""
|
||||
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:
|
||||
"""
|
||||
must raise InitializeError if no repositories set
|
||||
|
||||
Reference in New Issue
Block a user