35 lines
713 B
Go
35 lines
713 B
Go
|
package services_test
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"code.icb4dc0.de/prskr/searcherside/core/services"
|
||
|
)
|
||
|
|
||
|
func TestPasswordHash_UnmarshalText(t *testing.T) {
|
||
|
type args struct {
|
||
|
text []byte
|
||
|
}
|
||
|
tests := []struct {
|
||
|
name string
|
||
|
args args
|
||
|
wantErr bool
|
||
|
}{
|
||
|
{
|
||
|
name: "Basic test",
|
||
|
args: args{
|
||
|
text: []byte("$argon2id$v=19$m=65536,t=3,p=2$RiKQX+VDY9FtotJETFq8WQ$uCWUzPOlKpIinzryBfy31IHjhn5miKvtS5hER5H+1RE"),
|
||
|
},
|
||
|
wantErr: false,
|
||
|
},
|
||
|
}
|
||
|
for _, tt := range tests {
|
||
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
p := &services.PasswordHash{}
|
||
|
if err := p.UnmarshalText(tt.args.text); (err != nil) != tt.wantErr {
|
||
|
t.Errorf("UnmarshalText() error = %v, wantErr %v", err, tt.wantErr)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|