Implement owner setup and browser authentication sessions
This commit is contained in:
parent
077cf7601a
commit
715423ab8e
21 changed files with 2185 additions and 14 deletions
26
internal/domain/identity_test.go
Normal file
26
internal/domain/identity_test.go
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package domain
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNewOwnerIdentityNormalizesAndFoldsUsername(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
identity, err := NewOwnerIdentity(" ÉLIJAH ", " Elijah Kuntz ")
|
||||
if err != nil {
|
||||
t.Fatalf("NewOwnerIdentity returned an error: %v", err)
|
||||
}
|
||||
if identity.Username != "ÉLIJAH" || identity.UsernameKey != "élijah" || identity.DisplayName != "Elijah Kuntz" {
|
||||
t.Fatalf("unexpected identity: %#v", identity)
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidatePasswordRejectsShortPassword(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if err := ValidatePassword("too-short"); !errors.Is(err, ErrInvalidPassword) {
|
||||
t.Fatalf("ValidatePassword error = %v, want %v", err, ErrInvalidPassword)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue