From cb1b5c48145f9c23eae95f922c6af804466bcb42 Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Wed, 4 Jun 2025 01:30:57 +0900 Subject: Handle summaries of certs not retrieved --- tst/test_check.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'tst/test_check.py') diff --git a/tst/test_check.py b/tst/test_check.py index 397b9ca..f809a90 100644 --- a/tst/test_check.py +++ b/tst/test_check.py @@ -26,7 +26,7 @@ from hypothesis import given from pytest import mark from trustme import CA -from scadere.check import base64_from_str, check +from scadere.check import CtlChrTrans, base64_from_str, check from scadere.listen import parse_summary, str_from_base64 SECONDS_AGO = datetime.now(tz=timezone.utc) @@ -36,7 +36,8 @@ NEXT_WEEK = SECONDS_AGO + timedelta(days=7) @given(...) def test_base64(string: str): - assert str_from_base64(base64_from_str(string)) == string + printable_string = string.translate(CtlChrTrans()) + assert str_from_base64(base64_from_str(string)) == printable_string async def noop(reader, writer): @@ -84,10 +85,10 @@ async def test_check(domain, ca_name, not_after, after, trust_ca): ca if trust_ca else None) if not trust_ca: assert failed_to_get_cert(summary) - assert 'self-signed certificate' in summary[-1] + assert 'self-signed certificate' in str_from_base64(summary[-1]) elif not_after == SECONDS_AGO: assert failed_to_get_cert(summary) - assert 'certificate has expired' in summary[-1] + assert 'certificate has expired' in str_from_base64(summary[-1]) elif not_after > after: assert summary is None else: -- cgit 1.4.1