File: test_go.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 (38 lines) | stat: -rw-r--r-- 789 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
34
35
36
37
38
# MIT licensed
# Copyright (c) 2024 bgme <i@bgme.me>.

import pytest

from nvchecker.api import HTTPError

try:
  import lxml
  lxml_available = True
except ImportError:
  lxml_available = False

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


async def test_go(get_version):
  ver = await get_version("one version", {
    "source": "go",
    "go": "github.com/caddyserver/replace-response",
  })

  assert ver.startswith("v0.0.0-")

  assert await get_version("multiple version", {
    "source": "go",
    "go": "github.com/corazawaf/coraza-caddy",
  }) == "v1.2.2"

  with pytest.raises(HTTPError):
    await get_version("not found", {
      "source": "go",
      "go": "github.com/asdas/sadfasdf",
    })