From 44f48a8cf290af1bb9168cd7ea9dd3ed172dee9b Mon Sep 17 00:00:00 2001 From: Antoine GIRARD Date: Mon, 29 Apr 2019 02:44:39 +0200 Subject: [PATCH] improve tests --- models/gpg_key_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/models/gpg_key_test.go b/models/gpg_key_test.go index ef2b93c85..e97579fb5 100644 --- a/models/gpg_key_test.go +++ b/models/gpg_key_test.go @@ -10,6 +10,7 @@ import ( "time" "code.gitea.io/gitea/modules/timeutil" + "github.com/keybase/go-crypto/openpgp" "github.com/stretchr/testify/assert" ) @@ -407,8 +408,14 @@ FkzJRllII58iAA== ekey, err := checkArmoredGPGKeyString(testIssue6778) assert.NoError(t, err) + assert.Equal(t, 1, len(ekey.Identities)) //Should not output the revoked uid + + //Inspired from https://github.com/keybase/go-crypto/blob/master/openpgp/keys_test.go#L519 + var identities []*openpgp.Identity for _, ident := range ekey.Identities { + identities = append(identities, ident) email := strings.ToLower(strings.TrimSpace(ident.UserId.Email)) t.Logf("DEBUG: %s", email) } + assert.Contains(t, identities[0].Name, "Alden Peeters