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)