Add unit test for libkeyringctl.sequoia.packet_kinds

tests/test_sequoia.py:
Add unit test for libkeyringctl.sequoia.packet_kinds.
This commit is contained in:
David Runge 2021-11-07 23:39:42 +01:00 committed by Levente Polyak
parent 5f36beff90
commit 17d27e2274
No known key found for this signature in database
GPG Key ID: FC1B547C8D8172C8

View File

@ -15,6 +15,7 @@ from pytest import raises
from libkeyringctl import sequoia
from libkeyringctl.types import Fingerprint
from libkeyringctl.types import PacketKind
from libkeyringctl.types import Uid
from libkeyringctl.types import Username
@ -205,6 +206,22 @@ def test_packet_signature_creation_time(packet_dump_field_mock: Mock) -> None:
)
@patch("libkeyringctl.sequoia.packet_dump")
def test_packet_kinds(packet_dump_mock: Mock) -> None:
lines = [
"Type1 something",
" foo",
"Type2",
"WARNING",
"Type3 other",
" bar",
]
path = Path("foo")
packet_dump_mock.return_value = "\n".join(lines)
assert sequoia.packet_kinds(packet=path) == [PacketKind("Type1"), PacketKind("Type2"), PacketKind("Type3")]
@patch("libkeyringctl.sequoia.packet_signature_creation_time")
def test_latest_certification(packet_signature_creation_time_mock: Mock) -> None:
now = datetime.now(tz=timezone.utc)