diff --git a/tests/test_signer.py b/tests/test_signer.py index 7218198b1..9ac3ad3a8 100644 --- a/tests/test_signer.py +++ b/tests/test_signer.py @@ -419,6 +419,18 @@ def test_gpg_sign_and_verify_object(self): self.assertTrue(verify_sig(signature_dict, key_data, self.test_data)) self.assertFalse(verify_sig(signature_dict, key_data, self.wrong_data)) + def test_gpg_signature_data_structure(self): + """Test custom fields and legacy data structure in gpg signatures.""" + signer = GPGSigner(homedir=self.gnupg_home) + sig = signer.sign(self.test_data) + self.assertIn("other_headers", sig.unrecognized_fields) + + sig_dict = GPGSigner._to_gpg_sig(sig) + self.assertIn("signature", sig_dict) + self.assertNotIn("sig", sig_dict) + sig2 = GPGSigner._from_gpg_sig(sig_dict) + self.assertEqual(sig, sig2) + # Run the unit tests. if __name__ == "__main__":