mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-12-19 21:53:41 +00:00
use own aur wrapper (#49)
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
import aur
|
||||
import pytest
|
||||
|
||||
from aiohttp.test_utils import TestClient
|
||||
from pytest_mock import MockerFixture
|
||||
|
||||
from ahriman.models.aur_package import AURPackage
|
||||
from ahriman.models.user_access import UserAccess
|
||||
from ahriman.web.views.service.search import SearchView
|
||||
|
||||
@ -17,11 +17,11 @@ async def test_get_permission() -> None:
|
||||
assert await SearchView.get_permission(request) == UserAccess.Read
|
||||
|
||||
|
||||
async def test_get(client: TestClient, aur_package_ahriman: aur.Package, mocker: MockerFixture) -> None:
|
||||
async def test_get(client: TestClient, aur_package_ahriman: AURPackage, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must call get request correctly
|
||||
"""
|
||||
mocker.patch("ahriman.web.views.service.search.aur_search", return_value=[aur_package_ahriman])
|
||||
mocker.patch("ahriman.core.alpm.aur.AUR.multisearch", return_value=[aur_package_ahriman])
|
||||
response = await client.get("/service-api/v1/search", params={"for": "ahriman"})
|
||||
|
||||
assert response.ok
|
||||
@ -33,7 +33,7 @@ async def test_get_exception(client: TestClient, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must raise 400 on empty search string
|
||||
"""
|
||||
search_mock = mocker.patch("ahriman.web.views.service.search.aur_search", return_value=[])
|
||||
search_mock = mocker.patch("ahriman.core.alpm.aur.AUR.multisearch", return_value=[])
|
||||
response = await client.get("/service-api/v1/search")
|
||||
|
||||
assert response.status == 404
|
||||
@ -44,7 +44,7 @@ async def test_get_join(client: TestClient, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must join search args with space
|
||||
"""
|
||||
search_mock = mocker.patch("ahriman.web.views.service.search.aur_search")
|
||||
search_mock = mocker.patch("ahriman.core.alpm.aur.AUR.multisearch")
|
||||
response = await client.get("/service-api/v1/search", params=[("for", "ahriman"), ("for", "maybe")])
|
||||
|
||||
assert response.ok
|
||||
|
||||
Reference in New Issue
Block a user