forked from TrueCloudLab/frostfs-api-go
fa18f5ede7
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
32 lines
607 B
Go
32 lines
607 B
Go
package owner
|
|
|
|
import (
|
|
"crypto/rand"
|
|
"testing"
|
|
|
|
"github.com/nspcc-dev/neofs-crypto/test"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestIDV2(t *testing.T) {
|
|
id := NewID()
|
|
|
|
wallet := new(NEO3Wallet)
|
|
|
|
_, err := rand.Read(wallet.Bytes())
|
|
require.NoError(t, err)
|
|
|
|
id.SetNeo3Wallet(wallet)
|
|
|
|
idV2 := id.ToV2()
|
|
|
|
require.Equal(t, wallet.Bytes(), idV2.GetValue())
|
|
}
|
|
|
|
func TestNewIDFromNeo3Wallet(t *testing.T) {
|
|
wallet, err := NEO3WalletFromPublicKey(&test.DecodeKey(1).PublicKey)
|
|
require.NoError(t, err)
|
|
|
|
id := NewIDFromNeo3Wallet(wallet)
|
|
require.Equal(t, id.ToV2().GetValue(), wallet.Bytes())
|
|
}
|