2021-01-28 10:05:58 +00:00
|
|
|
# MIT licensed
|
|
|
|
# Copyright (c) 2021 lilydjwg <lilydjwg@gmail.com>, et al.
|
|
|
|
|
|
|
|
import pytest
|
2021-06-11 08:18:39 +00:00
|
|
|
import pytest_httpbin
|
|
|
|
assert pytest_httpbin # for pyflakes
|
2021-01-28 10:05:58 +00:00
|
|
|
|
2023-12-09 11:17:31 +00:00
|
|
|
pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net]
|
2021-01-28 10:05:58 +00:00
|
|
|
|
|
|
|
async def test_redirection(get_version):
|
2021-01-29 08:48:00 +00:00
|
|
|
assert await get_version("unifiedremote", {
|
2021-01-28 10:05:58 +00:00
|
|
|
"source": "httpheader",
|
2021-01-29 08:11:11 +00:00
|
|
|
"url": "https://www.unifiedremote.com/download/linux-x64-deb",
|
|
|
|
"regex": r'urserver-([\d.]+).deb',
|
2021-06-11 08:18:39 +00:00
|
|
|
}) is not None
|
2021-01-28 10:05:58 +00:00
|
|
|
|
2021-06-11 08:18:39 +00:00
|
|
|
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
|