mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-16 06:58:20 +00:00
2d6f4ebf18
* begin accounts-v2 new * password validation * validator accounts new with eip-2335 keystore * select different wallet type based on enum * clean up code significantly * more robust code structure * check if wallet exists * define read and create wallet methods * fmt * go mod and comment * comment * redundant name * satify gofmt * add instructions with keymanager opts * wrap up create and read wallet functionality * prep for readiness * doc improvements * tests for create and read wallet * update deps * tidy * visibility * gaz * fix up * refactor for proper usage, with wallet and keymanager ifaces * Update validator/flags/flags.go Co-authored-by: Ivan Martinez <ivanthegreatdev@gmail.com> * import * improve structure * wrap up all comments * simplify * lint * Update validator/accounts/v2/cmd.go * viz check * add interface methods as needed * fix build * lint * nishant feedback * simplify structure * add tests for strong password check * all feedback done * ivan feedback * ivan feedback Co-authored-by: Ivan Martinez <ivanthegreatdev@gmail.com> Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
45 lines
980 B
Go
45 lines
980 B
Go
package v2
|
|
|
|
import "testing"
|
|
|
|
func Test_validatePasswordInput(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
input string
|
|
wantErr bool
|
|
}{
|
|
{
|
|
name: "no numbers nor special characters",
|
|
input: "abcdefghijklmnopqrs",
|
|
wantErr: true,
|
|
},
|
|
{
|
|
name: "number and letters but no special characters",
|
|
input: "abcdefghijklmnopqrs2020",
|
|
wantErr: true,
|
|
},
|
|
{
|
|
name: "numbers, letters, special characters, but too short",
|
|
input: "abc2$",
|
|
wantErr: true,
|
|
},
|
|
{
|
|
name: "proper length and strong password",
|
|
input: "%Str0ngpassword32kjAjsd22020$%",
|
|
wantErr: false,
|
|
},
|
|
{
|
|
name: "password format correct but weak entropy score",
|
|
input: "aaaaaaa1$",
|
|
wantErr: true,
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if err := validatePasswordInput(tt.input); (err != nil) != tt.wantErr {
|
|
t.Errorf("validatePasswordInput() error = %v, wantErr %v", err, tt.wantErr)
|
|
}
|
|
})
|
|
}
|
|
}
|