mirror of
https://github.com/lilydjwg/nvchecker.git
synced 2025-03-10 06:14:02 +00:00
tests: fix dep on httpbin
This commit is contained in:
parent
2a63ddef7a
commit
9f6706e0e7
2 changed files with 125 additions and 110 deletions
|
@ -1,12 +1,18 @@
|
||||||
# MIT licensed
|
# MIT licensed
|
||||||
# Copyright (c) 2021 lilydjwg <lilydjwg@gmail.com>, et al.
|
# Copyright (c) 2021,2024 lilydjwg <lilydjwg@gmail.com>, et al.
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import pytest_httpbin
|
|
||||||
assert pytest_httpbin # for pyflakes
|
|
||||||
|
|
||||||
pytestmark = [pytest.mark.asyncio(scope="session"), pytest.mark.needs_net]
|
httpbin_available = True
|
||||||
|
try:
|
||||||
|
import pytest_httpbin
|
||||||
|
assert pytest_httpbin # for pyflakes
|
||||||
|
except ImportError:
|
||||||
|
httpbin_available = False
|
||||||
|
|
||||||
|
pytestmark = pytest.mark.asyncio(scope="session")
|
||||||
|
|
||||||
|
@pytest.mark.needs_net
|
||||||
async def test_redirection(get_version):
|
async def test_redirection(get_version):
|
||||||
assert await get_version("unifiedremote", {
|
assert await get_version("unifiedremote", {
|
||||||
"source": "httpheader",
|
"source": "httpheader",
|
||||||
|
@ -14,6 +20,7 @@ async def test_redirection(get_version):
|
||||||
"regex": r'urserver-([\d.]+).deb',
|
"regex": r'urserver-([\d.]+).deb',
|
||||||
}) is not None
|
}) is not None
|
||||||
|
|
||||||
|
@pytest.mark.skipif(not httpbin_available, reason="needs pytest_httpbin")
|
||||||
async def test_get_version_withtoken(get_version, httpbin):
|
async def test_get_version_withtoken(get_version, httpbin):
|
||||||
assert await get_version("unifiedremote", {
|
assert await get_version("unifiedremote", {
|
||||||
"source": "httpheader",
|
"source": "httpheader",
|
||||||
|
|
|
@ -1,13 +1,21 @@
|
||||||
# MIT licensed
|
# MIT licensed
|
||||||
# Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al.
|
# Copyright (c) 2013-2020,2024 lilydjwg <lilydjwg@gmail.com>, et al.
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import pytest_httpbin
|
|
||||||
assert pytest_httpbin # for pyflakes
|
|
||||||
|
|
||||||
pytestmark = pytest.mark.asyncio(scope="session")
|
httpbin_available = True
|
||||||
|
try:
|
||||||
|
import pytest_httpbin
|
||||||
|
assert pytest_httpbin # for pyflakes
|
||||||
|
except ImportError:
|
||||||
|
httpbin_available = False
|
||||||
|
|
||||||
|
pytestmark = [
|
||||||
|
pytest.mark.asyncio(scope="session"),
|
||||||
|
pytest.mark.skipif(not httpbin_available, reason="needs pytest_httpbin"),
|
||||||
|
]
|
||||||
|
|
||||||
def base64_encode(s):
|
def base64_encode(s):
|
||||||
return base64.b64encode(s.encode('utf-8')).decode('ascii')
|
return base64.b64encode(s.encode('utf-8')).decode('ascii')
|
||||||
|
|
Loading…
Add table
Reference in a new issue