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:
parent
5f36beff90
commit
17d27e2274
@ -15,6 +15,7 @@ from pytest import raises
|
|||||||
|
|
||||||
from libkeyringctl import sequoia
|
from libkeyringctl import sequoia
|
||||||
from libkeyringctl.types import Fingerprint
|
from libkeyringctl.types import Fingerprint
|
||||||
|
from libkeyringctl.types import PacketKind
|
||||||
from libkeyringctl.types import Uid
|
from libkeyringctl.types import Uid
|
||||||
from libkeyringctl.types import Username
|
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")
|
@patch("libkeyringctl.sequoia.packet_signature_creation_time")
|
||||||
def test_latest_certification(packet_signature_creation_time_mock: Mock) -> None:
|
def test_latest_certification(packet_signature_creation_time_mock: Mock) -> None:
|
||||||
now = datetime.now(tz=timezone.utc)
|
now = datetime.now(tz=timezone.utc)
|
||||||
|
Loading…
Reference in New Issue
Block a user