Test missing email explicitly

This commit is contained in:
Daniel Krol 2022-06-17 16:15:27 -04:00
parent da849cc9be
commit 19ed8f9f89
2 changed files with 10 additions and 0 deletions

View file

@ -169,6 +169,11 @@ func TestServerValidateAuthRequest(t *testing.T) {
t.Fatalf("Expected AuthRequest with email with unexpected formatting to not successfully validate") t.Fatalf("Expected AuthRequest with email with unexpected formatting to not successfully validate")
} }
authRequest = AuthRequest{DeviceId: "dId", Password: "aoeu"}
if authRequest.validate() {
t.Fatalf("Expected AuthRequest with missing email to not successfully validate")
}
authRequest = AuthRequest{DeviceId: "dId", Email: "joe@example.com"} authRequest = AuthRequest{DeviceId: "dId", Email: "joe@example.com"}
if authRequest.validate() { if authRequest.validate() {
t.Fatalf("Expected AuthRequest with missing password to not successfully validate") t.Fatalf("Expected AuthRequest with missing password to not successfully validate")

View file

@ -59,6 +59,11 @@ func TestServerValidateRegisterRequest(t *testing.T) {
t.Fatalf("Expected RegisterRequest with email with unexpected formatting to not successfully validate") t.Fatalf("Expected RegisterRequest with email with unexpected formatting to not successfully validate")
} }
registerRequest = RegisterRequest{Password: "aoeu"}
if registerRequest.validate() {
t.Fatalf("Expected RegisterRequest with missing email to not successfully validate")
}
registerRequest = RegisterRequest{Email: "joe@example.com"} registerRequest = RegisterRequest{Email: "joe@example.com"}
if registerRequest.validate() { if registerRequest.validate() {
t.Fatalf("Expected RegisterRequest with missing password to not successfully validate") t.Fatalf("Expected RegisterRequest with missing password to not successfully validate")