Skip to content

Commit

Permalink
crypto: adjust TestPublicKeys_Copy
Browse files Browse the repository at this point in the history
Since the AllowedGroups []*keys.PublicKey slice is used in the
initialization, the test should use the same structures.

Signed-off-by: Ekaterina Pavlova <[email protected]>
  • Loading branch information
AliceInHunterland committed Apr 27, 2024
1 parent 7c8d2c3 commit 1292a00
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/crypto/keys/publickey_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,18 @@ func TestEncodeDecodePublicKey(t *testing.T) {
func TestPublicKeys_Copy(t *testing.T) {
require.Nil(t, (PublicKeys)(nil).Copy())

pubs := make(PublicKeys, 5)
for i := range pubs {
pubz := make([]*PublicKey, 5)
for i := range pubz {
priv, err := NewPrivateKey()
require.NoError(t, err)
pubs[i] = priv.PublicKey()
pubz[i] = priv.PublicKey()
}
pubs := PublicKeys(pubz)

cp := pubs.Copy()
var pubx = ([]*PublicKey)(cp)
require.Equal(t, pubz, pubx)

priv, err := NewPrivateKey()
require.NoError(t, err)
cp[0] = priv.PublicKey()
Expand Down

0 comments on commit 1292a00

Please sign in to comment.