mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-27 21:57:16 +00:00
6e3b78b99e
* Ran code cleanup from goland * Typo
29 lines
604 B
Go
29 lines
604 B
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/json"
|
|
"reflect"
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/tools/unencrypted-keys-gen/keygen"
|
|
)
|
|
|
|
func TestSavesUnencryptedKeys(t *testing.T) {
|
|
keys := 2
|
|
numKeys = &keys
|
|
ctnr := generateUnencryptedKeys(0 /* start index */)
|
|
buf := new(bytes.Buffer)
|
|
if err := keygen.SaveUnencryptedKeysToFile(buf, ctnr); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
enc := buf.Bytes()
|
|
dec := &keygen.UnencryptedKeysContainer{}
|
|
if err := json.Unmarshal(enc, dec); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if !reflect.DeepEqual(ctnr, dec) {
|
|
t.Errorf("Wanted %v, received %v", ctnr, dec)
|
|
}
|
|
}
|