mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-04-24 07:17:17 +00:00
* add external process spawner and update test cases * pass no_report to handlers * provide service api endpoints * do not spawn process for single architecture run * pass no report to handlers * make _call method of handlers public and also simplify process spawn * move update under add * implement actions from web page * clear logging & improve l&f
25 lines
802 B
Python
25 lines
802 B
Python
from aiohttp.test_utils import TestClient
|
|
from pytest_mock import MockerFixture
|
|
|
|
|
|
async def test_post(client: TestClient, mocker: MockerFixture) -> None:
|
|
"""
|
|
must call post request correctly
|
|
"""
|
|
add_mock = mocker.patch("ahriman.core.spawn.Spawn.packages_remove")
|
|
response = await client.post("/service-api/v1/remove", json={"packages": ["ahriman"]})
|
|
|
|
assert response.status == 200
|
|
add_mock.assert_called_with(["ahriman"])
|
|
|
|
|
|
async def test_post_exception(client: TestClient, mocker: MockerFixture) -> None:
|
|
"""
|
|
must raise exception on missing packages payload
|
|
"""
|
|
add_mock = mocker.patch("ahriman.core.spawn.Spawn.packages_remove")
|
|
response = await client.post("/service-api/v1/remove")
|
|
|
|
assert response.status == 400
|
|
add_mock.assert_not_called()
|