mirror of
https://github.com/lilydjwg/nvchecker
synced 2024-12-26 08:32:21 +00:00
9deb55806d
add an httptoken option; add htmlparser with xpath source Co-authored-by: Maud LAURENT <maud.laurent@eurecia.com> Co-authored-by: lilydjwg <lilydjwg@gmail.com>
25 lines
812 B
Python
25 lines
812 B
Python
# MIT licensed
|
|
# Copyright (c) 2021 lilydjwg <lilydjwg@gmail.com>, et al.
|
|
|
|
import pytest
|
|
import pytest_httpbin
|
|
assert pytest_httpbin # for pyflakes
|
|
|
|
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
|
|
|
|
async def test_redirection(get_version):
|
|
assert await get_version("unifiedremote", {
|
|
"source": "httpheader",
|
|
"url": "https://www.unifiedremote.com/download/linux-x64-deb",
|
|
"regex": r'urserver-([\d.]+).deb',
|
|
}) is not None
|
|
|
|
async def test_get_version_withtoken(get_version, httpbin):
|
|
assert await get_version("unifiedremote", {
|
|
"source": "httpheader",
|
|
"url": httpbin.url + "/basic-auth/username/superpassword",
|
|
"httptoken": "Basic dXNlcm5hbWU6c3VwZXJwYXNzd29yZA==",
|
|
"header": "server",
|
|
"regex": r'([0-9.]+)*',
|
|
}) is not None
|