-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add route to check user email verified status (#87)
- Loading branch information
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,4 +116,26 @@ func TestAuth(t *testing.T) { | |
s.echoInstance.ServeHTTP(rec, req) | ||
assert.Equal(t, http.StatusUnauthorized, rec.Code) | ||
}) | ||
|
||
// TODO: re-order this test when the verification for the email tests are merged. | ||
// this tets has to run before it to pass | ||
// Then a new test should be added to cover the status when it is 'true' | ||
t.Run("email verified status", func(t *testing.T) { | ||
req := httptest.NewRequest(http.MethodGet, "/api/v1/auth/[email protected]", nil) | ||
rec := httptest.NewRecorder() | ||
s.echoInstance.ServeHTTP(rec, req) | ||
assert.Equal(t, http.StatusOK, rec.Code) | ||
|
||
var response EmailVerifiedStatusResponse | ||
err := json.Unmarshal(rec.Body.Bytes(), &response) | ||
assert.Nil(t, err) | ||
assert.False(t, response.Verified) | ||
}) | ||
|
||
t.Run("email verified status - missing email query param", func(t *testing.T) { | ||
req := httptest.NewRequest(http.MethodGet, "/api/v1/auth/ami-verified", nil) | ||
rec := httptest.NewRecorder() | ||
s.echoInstance.ServeHTTP(rec, req) | ||
assert.Equal(t, http.StatusBadRequest, rec.Code) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters