prysm-pulse/tools/unencrypted-keys-gen/main_test.go
Raul Jordan 6f25e4ce81 Use Start Index Flag in Unencrypted Key Gen (#3506)
* use start idx

* fix tests
2019-09-18 10:15:26 -07:00

25 lines
493 B
Go

package main
import (
"bytes"
"encoding/json"
"reflect"
"testing"
)
func TestSavesUnencryptedKeys(t *testing.T) {
ctnr := generateUnencryptedKeys(0 /* start index */)
buf := new(bytes.Buffer)
if err := SaveUnencryptedKeysToFile(buf, ctnr); err != nil {
t.Fatal(err)
}
enc := buf.Bytes()
dec := &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)
}
}