diff --git a/cmd/otpgateway/handlers_test.go b/cmd/otpgateway/handlers_test.go index 85bdaee..54bf2cc 100644 --- a/cmd/otpgateway/handlers_test.go +++ b/cmd/otpgateway/handlers_test.go @@ -234,15 +234,14 @@ func TestCheckOTP(t *testing.T) { // Check it again. Should be deleted. r = testRequest(t, http.MethodPost, "/api/otp/"+dummyOTPID, cp, &data) - assert.NotEqual(t, http.StatusOK, r.StatusCode, "OTP didn't get deleted on verification") + assert.Equal(t, http.StatusGone, r.StatusCode, "OTP didn't get deleted on verification") - // Check non-existent OTP, should not return 200. + // Check non-existent OTP, should return 410 Gone. r = testRequest(t, http.MethodPost, "/api/otp/abc123", cp, &data) - assert.NotEqual(t, http.StatusOK, r.StatusCode, "non-existent OTP didn't return 200") + assert.Equal(t, http.StatusGone, r.StatusCode, "non-existent OTP didn't return 410") - // Check non-existent OTP, should return 410. - r = testRequest(t, http.MethodPost, "/api/otp/abc123", cp, &out) - assert.Equal(t, http.StatusGone, r.StatusCode, "non-existent OTP returns 410") + // Check non-existent OTP, should return store.ErrNotExist error message. + _ = testRequest(t, http.MethodPost, "/api/otp/abc123", cp, &out) assert.Equal(t, "OTP has expired or doesn't exist", out.Message, "non-existent OTP passed") }