crypto: adjust TestPublicKeys_Copy

Since the AllowedGroups []*keys.PublicKey slice is used in the
initialization, the test should use the same structures.

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
This commit is contained in:
Ekaterina Pavlova 2024-04-28 00:06:17 +05:30
parent 7c8d2c3ec5
commit 1292a00ef9

View file

@ -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()