Enforce account status on email, phone OTP, social login, token refresh, and authenticated learner requests. Co-authored-by: Cursor <cursoragent@cursor.com>
23 lines
508 B
Go
23 lines
508 B
Go
package domain
|
|
|
|
import "testing"
|
|
|
|
func TestValidateUserCanAuthenticate(t *testing.T) {
|
|
cases := []struct {
|
|
status UserStatus
|
|
want error
|
|
}{
|
|
{UserStatusActive, nil},
|
|
{UserStatusPending, ErrUserNotVerified},
|
|
{UserStatusSuspended, ErrUserAccountLocked},
|
|
{UserStatusDeactivated, ErrUserAccountLocked},
|
|
}
|
|
|
|
for _, tc := range cases {
|
|
got := ValidateUserCanAuthenticate(tc.status)
|
|
if got != tc.want {
|
|
t.Fatalf("ValidateUserCanAuthenticate(%q)=%v, want %v", tc.status, got, tc.want)
|
|
}
|
|
}
|
|
}
|