mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-09-16 21:59:56 +00:00
move update under add
This commit is contained in:
@ -63,15 +63,6 @@ def test_packages_remove(spawner: Spawn, mocker: MockerFixture) -> None:
|
||||
spawn_mock.assert_called_with("remove", "ahriman", "linux")
|
||||
|
||||
|
||||
def test_packages_update(spawner: Spawn, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must call package updates
|
||||
"""
|
||||
spawn_mock = mocker.patch("ahriman.core.spawn.Spawn.spawn_process")
|
||||
spawner.packages_update(["ahriman", "linux"])
|
||||
spawn_mock.assert_called_with("update", "ahriman", "linux")
|
||||
|
||||
|
||||
def test_spawn_process(spawner: Spawn, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must correctly spawn child process
|
||||
|
@ -10,7 +10,7 @@ async def test_post(client: TestClient, mocker: MockerFixture) -> None:
|
||||
response = await client.post("/service-api/v1/add", json={"packages": ["ahriman"]})
|
||||
|
||||
assert response.status == 200
|
||||
add_mock.assert_called_with(["ahriman"], False)
|
||||
add_mock.assert_called_with(["ahriman"], True)
|
||||
|
||||
|
||||
async def test_post_now(client: TestClient, mocker: MockerFixture) -> None:
|
||||
@ -18,10 +18,10 @@ async def test_post_now(client: TestClient, mocker: MockerFixture) -> None:
|
||||
must call post and run build
|
||||
"""
|
||||
add_mock = mocker.patch("ahriman.core.spawn.Spawn.packages_add")
|
||||
response = await client.post("/service-api/v1/add", json={"packages": ["ahriman"], "build_now": True})
|
||||
response = await client.post("/service-api/v1/add", json={"packages": ["ahriman"], "build_now": False})
|
||||
|
||||
assert response.status == 200
|
||||
add_mock.assert_called_with(["ahriman"], True)
|
||||
add_mock.assert_called_with(["ahriman"], False)
|
||||
|
||||
|
||||
async def test_post_exception(client: TestClient, mocker: MockerFixture) -> None:
|
||||
@ -33,3 +33,14 @@ async def test_post_exception(client: TestClient, mocker: MockerFixture) -> None
|
||||
|
||||
assert response.status == 400
|
||||
add_mock.assert_not_called()
|
||||
|
||||
|
||||
async def test_post_update(client: TestClient, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must call post request correctly for alias
|
||||
"""
|
||||
add_mock = mocker.patch("ahriman.core.spawn.Spawn.packages_add")
|
||||
response = await client.post("/service-api/v1/update", json={"packages": ["ahriman"]})
|
||||
|
||||
assert response.status == 200
|
||||
add_mock.assert_called_with(["ahriman"], True)
|
||||
|
@ -1,24 +0,0 @@
|
||||
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_update")
|
||||
response = await client.post("/service-api/v1/update", 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_update")
|
||||
response = await client.post("/service-api/v1/update")
|
||||
|
||||
assert response.status == 400
|
||||
add_mock.assert_not_called()
|
Reference in New Issue
Block a user