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:
parent
7c8d2c3ec5
commit
1292a00ef9
1 changed files with 7 additions and 3 deletions
|
@ -42,14 +42,18 @@ func TestEncodeDecodePublicKey(t *testing.T) {
|
||||||
func TestPublicKeys_Copy(t *testing.T) {
|
func TestPublicKeys_Copy(t *testing.T) {
|
||||||
require.Nil(t, (PublicKeys)(nil).Copy())
|
require.Nil(t, (PublicKeys)(nil).Copy())
|
||||||
|
|
||||||
pubs := make(PublicKeys, 5)
|
pubz := make([]*PublicKey, 5)
|
||||||
for i := range pubs {
|
for i := range pubz {
|
||||||
priv, err := NewPrivateKey()
|
priv, err := NewPrivateKey()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
pubs[i] = priv.PublicKey()
|
pubz[i] = priv.PublicKey()
|
||||||
}
|
}
|
||||||
|
pubs := PublicKeys(pubz)
|
||||||
|
|
||||||
cp := pubs.Copy()
|
cp := pubs.Copy()
|
||||||
|
var pubx = ([]*PublicKey)(cp)
|
||||||
|
require.Equal(t, pubz, pubx)
|
||||||
|
|
||||||
priv, err := NewPrivateKey()
|
priv, err := NewPrivateKey()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
cp[0] = priv.PublicKey()
|
cp[0] = priv.PublicKey()
|
||||||
|
|
Loading…
Reference in a new issue