nvchecker/tests/test_repology.py

40 lines
1.1 KiB
Python
Raw Normal View History

2019-10-29 15:40:24 +00:00
# MIT licensed
2020-08-17 08:31:59 +00:00
# Copyright (c) 2019-2020 lilydjwg <lilydjwg@gmail.com>, et al.
2019-10-29 15:40:24 +00:00
import pytest
pytestmark = [pytest.mark.asyncio,
2019-10-29 15:40:24 +00:00
pytest.mark.needs_net]
@pytest.mark.flaky(reruns=10)
2019-10-29 15:40:24 +00:00
async def test_repology(get_version):
2020-08-17 08:31:59 +00:00
assert await get_version("ssed", {
"source": "repology",
"repo": "aur",
}) == "3.62"
2019-10-29 15:40:24 +00:00
@pytest.mark.flaky(reruns=10)
async def test_repology_subrepo(get_version):
assert await get_version("asciiquarium", {
"source": "repology",
"repo": "fedora_32",
"subrepo": "release"
}) == "1.1"
async def test_repology_bad_subrepo(get_version):
try:
assert await get_version("asciiquarium", {
"source": "repology",
"repo": "fedora_32",
"subrepo": "badsubrepo"
}) is None
except RuntimeError as e:
assert "package is not found in subrepo" in str(e)
2019-10-29 15:40:24 +00:00
async def test_repology_no_repo(get_version):
try:
2020-08-17 08:31:59 +00:00
assert await get_version("ssed", {
"source": "repology",
}) is None
2019-10-29 15:40:24 +00:00
except RuntimeError as e:
assert "repo field is required" in str(e)