From fc31847f8e71405a580534ac0ed8c879fe70a1e5 Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Sat, 19 Nov 2016 20:06:29 +0200 Subject: [PATCH] decode: add test for custom markers --- trezor_agent/gpg/tests/test_decode.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/trezor_agent/gpg/tests/test_decode.py b/trezor_agent/gpg/tests/test_decode.py index 88b7ae4..92c9b8c 100644 --- a/trezor_agent/gpg/tests/test_decode.py +++ b/trezor_agent/gpg/tests/test_decode.py @@ -43,3 +43,16 @@ def test_gpg_files(public_key_path): # pylint: disable=redefined-outer-name with open(public_key_path, 'rb') as f: packets = list(decode.parse_packets(f)) assert len(packets) > 0 + + +def test_has_custom_subpacket(): + sig = {'unhashed_subpackets': []} + assert not decode.has_custom_subpacket(sig) + + custom_markers = [ + protocol.CUSTOM_SUBPACKET, + protocol.subpacket(10, protocol.CUSTOM_KEY_LABEL), + ] + for marker in custom_markers: + sig = {'unhashed_subpackets': [marker]} + assert decode.has_custom_subpacket(sig)