Commit a53cee10 authored by Chris Lamb's avatar Chris Lamb 💬

Compare .asc PGP signatures as text, not as a hexdump. (Closes: #908991,...

Compare .asc PGP signatures as text, not as a hexdump. (Closes: #908991, #7)
parent ed4d01eb
Pipeline #36999 passed with stage
in 14 minutes and 31 seconds
......@@ -37,7 +37,7 @@ def order_only_difference(unified_diff):
class TextFile(File):
DESCRIPTION = "text files"
FILE_TYPE_RE = re.compile(r'\btext\b')
FILE_TYPE_RE = re.compile(r'(?:\btext\b|^PGP signature Signature)')
@property
def encoding(self):
......
......@@ -19,6 +19,7 @@
import codecs
from diffoscope.comparators.text import TextFile
from diffoscope.comparators.binary import FilesystemFile
from diffoscope.comparators.utils.specialize import specialize
......@@ -89,3 +90,17 @@ def test_ordering_differences(text_order1, text_order2):
difference = text_order1.compare(text_order2)
assert difference.comments == ['ordering differences only']
assert difference.unified_diff == get_data('text_order_expected_diff')
signature1 = load_fixture('test1.asc')
signature2 = load_fixture('test2.asc')
def test_gpg_signature_identification(signature1, signature2):
assert isinstance(signature1, TextFile)
assert isinstance(signature2, TextFile)
def test_gpg_signature(signature1, signature2):
difference = signature1.compare(signature2)
assert difference.unified_diff == get_data('text_asc_expected_diff')
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEK9jU45eVX3dG2zuJrWkWlnOTmCsFAlhEVnIACgkQrWkWlnOT
mCvZew/+Nz4404NtdXBSXK9JfhLC8nxzwTLQBFWxT8FSwOPTHyS5Y40oWcIzuD1j
zGcqNgGyGPDJZ14bbe6qmoIAf6W+KMZB0PDl2C7hSiQR+yuK69mE0XXVONPH5U8H
/tvwZ/rBvOSp3qI0iBXwDPDEMHzg/r5rlTg2D+YvrU26kIyKlhw40cpPOC70gTAp
llE+QJKjDCYi39WD8ZgLVJ/xSdkF05IC0qBhrCFeccpSpsrOpMbRGRb/h5dlmSNb
krqH/0Nwq3uFMiwhT8WY0dGK8NTSsVExcw4u25TPeeyVh47zO4/urGmM7bX/XDhP
DLoh4EpNT2z9AEn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M8DFIPSfKdPC67Z/twb54hfR6ZQCZk9ANK4MWPgvQxw3
+gDi0dGfkAeMfqZMprRF3frdsbekASL3l3bFpx2ttcrZU5jrS5Nf3NS0u5XvGdyl2
+o16/+AATv//QNbBVmcrWfbphsr+8M9FdLLvRn9l21p7Ldrc8E49F2mrjr6lWj9Qn
+asOK8gkkFs2xxJI39PaGqXu2OkZmdFXlZuqqGRiSxIpLXNbjSs0tfe8pOeWzwNlK
+3s1uhcACrdPmolfUuNpehDKt9FddmS0tvck0GVJyjD1+Vs1emEIt1aCq1cgnomcT
+uu6g+w3xLnTqN2UIRIMbNrunjLfjzmD/RTtdw853n0e2LdgZ1Esh6eZMyCXMs/lv
+FVuZuJm5TUl1Z+YBFtYZS6kCYPSbXXSILKeInAtigdJJ/djKY3bkV0H9F0xVwbaW
+N/mSgfj7e5bbKTjjX98+gq4M6QRL4Fp9YQriLVG/e0ERJPj4qitVRTAcXzeXZg0T
+oyxyGtAjW3qxazVdTj+RWUaFQsgWc2jQ9F1N+rnuNZ9dbb4U9X7zjdW0Y+WWIKZk
+ci2YC09nl3yMguZdtfUiDUS5/LxaXbnI8Ao0EbpgCbyxvTRDU0CmCc/gZ+664wZ9
+YwkUKB4Gf0w3Jlx3we4Myyo2sRCZT+1EEB8qtbDoe/ylMFFWa0A=
+=JLnP
-----END PGP SIGNATURE-----
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment