From cc09ac3db538e5817c117521b22dc6ccb249996f Mon Sep 17 00:00:00 2001 From: Aron Wussler Date: Tue, 6 Dec 2022 18:07:15 +0100 Subject: [PATCH] Test serialization --- openpgp/keys_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/openpgp/keys_test.go b/openpgp/keys_test.go index 89e3b8cb..c1478771 100644 --- a/openpgp/keys_test.go +++ b/openpgp/keys_test.go @@ -950,6 +950,23 @@ func TestNotationPacket(t *testing.T) { t.Fatal(err) } + assertNotationPackets(t, keys) + + serializedEntity := bytes.NewBuffer(nil) + err = keys[0].Serialize(serializedEntity) + if err != nil { + t.Fatal(err) + } + + keys, err = ReadKeyRing(serializedEntity) + if err != nil { + t.Fatal(err) + } + + assertNotationPackets(t, keys) +} + +func assertNotationPackets(t *testing.T, keys EntityList) { if len(keys) != 1 { t.Errorf("Failed to accept key, %d", len(keys)) }