File: test_jq.py

package info (click to toggle)
python-nvchecker 2.16-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 736 kB
  • sloc: python: 4,801; makefile: 25
file content (33 lines) | stat: -rw-r--r-- 812 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# MIT licensed
# Copyright (c) 2024 Rocket Aaron <i@rocka.me>, et al.

import pytest

jq_available = True
try:
  import jq
except ImportError:
  jq_available = False

pytestmark = [
  pytest.mark.asyncio,
  pytest.mark.needs_net,
  pytest.mark.skipif(not jq_available, reason="needs jq"),
]

async def test_jq(get_version):
    ver = await get_version("aur", {
        "source": "jq",
        "url": "https://aur.archlinux.org/rpc/v5/info?arg[]=nvchecker-git"
    })
    ver = ver.strip()
    assert ver.startswith("{")
    assert ver.endswith("}")

async def test_jq_filter(get_version):
    ver = await get_version("aur", {
        "source": "jq",
        "url": "https://aur.archlinux.org/rpc/v5/info?arg[]=nvchecker-git",
        "filter": '.results[0].PackageBase',
    })
    assert ver == "nvchecker-git"