Skip to content

Commit 44f48a8

Browse files
committed
improve tests
1 parent 3c8f965 commit 44f48a8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

models/gpg_key_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"time"
1111

1212
"code.gitea.io/gitea/modules/timeutil"
13+
"github.com/keybase/go-crypto/openpgp"
1314

1415
"github.com/stretchr/testify/assert"
1516
)
@@ -407,8 +408,14 @@ FkzJRllII58iAA==
407408
ekey, err := checkArmoredGPGKeyString(testIssue6778)
408409
assert.NoError(t, err)
409410

411+
assert.Equal(t, 1, len(ekey.Identities)) //Should not output the revoked uid
412+
413+
//Inspired from https://github.com/keybase/go-crypto/blob/master/openpgp/keys_test.go#L519
414+
var identities []*openpgp.Identity
410415
for _, ident := range ekey.Identities {
416+
identities = append(identities, ident)
411417
email := strings.ToLower(strings.TrimSpace(ident.UserId.Email))
412418
t.Logf("DEBUG: %s", email)
413419
}
420+
assert.Contains(t, identities[0].Name, "Alden Peeters <alden.peeters@") //Should not output the revoked uid
414421
}

0 commit comments

Comments
 (0)