mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 21:07:18 +00:00
f5c88e1bcb
* clean up test * adding test setup * add chainstart check to sync querier * goimports * goimports * backend cleanup * adding getters * lint * moving to db * gazelle * adding more services setup * adding more changes * adding different test setups * other merge issues * imports * fixing keys * get intial sync able to be set up * new changes and gazelle * use simulated p2p * everything finally works * unexport fields * revert changes from merge * remove mock server * add documentation * gazelle * add another node * review comments * fix tests
31 lines
905 B
Go
31 lines
905 B
Go
package accounts
|
|
|
|
import (
|
|
"crypto/rand"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/shared/keystore"
|
|
"github.com/prysmaticlabs/prysm/shared/params"
|
|
"github.com/prysmaticlabs/prysm/shared/testutil"
|
|
)
|
|
|
|
func TestNewValidatorAccount_AccountExists(t *testing.T) {
|
|
directory := testutil.TempDir() + "/testkeystore"
|
|
defer os.RemoveAll(directory)
|
|
validatorKey, err := keystore.NewKey(rand.Reader)
|
|
if err != nil {
|
|
t.Fatalf("Cannot create new key: %v", err)
|
|
}
|
|
ks := keystore.NewKeystore(directory)
|
|
if err := ks.StoreKey(directory+params.BeaconConfig().ValidatorPrivkeyFileName, validatorKey, ""); err != nil {
|
|
t.Fatalf("Unable to store key %v", err)
|
|
}
|
|
if err := NewValidatorAccount(directory, ""); err == nil {
|
|
t.Error("Expected new validator account to throw error, received nil")
|
|
}
|
|
if err := os.RemoveAll(directory); err != nil {
|
|
t.Fatalf("Could not remove directory: %v", err)
|
|
}
|
|
}
|