prysm-pulse/tools/unencrypted-keys-gen/main_test.go
terence tsao 6e3b78b99e
Ran code cleanup from goland (#6064)
* Ran code cleanup from goland

* Typo
2020-05-31 15:08:36 -05:00

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)
}
}