diff options
Diffstat (limited to 'tst/test_listen.py')
-rw-r--r-- | tst/test_listen.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tst/test_listen.py b/tst/test_listen.py index 3862d9d..45289d5 100644 --- a/tst/test_listen.py +++ b/tst/test_listen.py @@ -30,13 +30,13 @@ from xml.etree.ElementTree import (XML, XMLParser, indent, tostring as str_from_xml) from hypothesis import HealthCheck, given, settings -from hypothesis.strategies import (booleans, builds, composite, - data, datetimes, from_type, - integers, lists, sampled_from, text) +from hypothesis.strategies import (booleans, composite, data, + datetimes, from_type, integers, + lists, sampled_from, text) from hypothesis.provisional import domains, urls from pytest import raises -from scadere.check import base64_from_str +from scadere.check import base64_from_str, printable from scadere.listen import handle, is_subdomain, path, with_trailing_slash, xml ATOM_NAMESPACES = {'': 'http://www.w3.org/2005/Atom'} @@ -50,12 +50,12 @@ def ports(): def serials(): """Return a Hypothesis strategy for TLS serial number.""" - return builds(lambda n: hex(n).removeprefix('0x'), integers(0, 256**20-1)) + return integers(0, 256**20-1) def base64s(): - """Return a Hypothesis strategy for CA names.""" - return text().map(base64_from_str) + """Return a Hypothesis strategy for printable strings in base64.""" + return text().filter(printable).map(base64_from_str) @given(domains(), ports(), base64s(), serials()) @@ -64,7 +64,7 @@ def test_path_with_cert(hostname, port, issuer, serial): assert r[0] == hostname assert int(r[1]) == port assert r[2] == issuer - assert r[3] == serial + assert int(r[3]) == serial @given(domains(), ports(), base64s()) |