nvchecker/tests/test_htmlpasrer.py
Maud LAURENT 9deb55806d
Add optional token for regex and httpheader. Add htmlparser source (#182)
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>
2021-06-11 16:18:39 +08:00

22 lines
639 B
Python

# MIT licensed
# Copyright (c) 2021 ypsilik <tt2laurent.maud@gmail.com>, et al.
import pytest
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
async def test_xpath_ok(get_version):
assert await get_version("unifiedremote", {
"source": "htmlparser",
"url": "http://httpbin.org/",
"xpath": '//pre[@class="version"]/text()',
}) != None
async def test_xpath_missing_ok(get_version):
assert await get_version("unifiedremote", {
"source": "htmlparser",
"url": "http://httpbin.org/",
"xpath": '//pre[@class="test-is-ok"]/text()',
"missing_ok": True,
}) is None