@@ -238,11 +238,12 @@ func TestCheckOTP(t *testing.T) {
238238
239239 // Check non-existent OTP, should not return 200.
240240 r = testRequest (t , http .MethodPost , "/api/otp/abc123" , cp , & data )
241- assert .NotEqual (t , http .StatusOK , r .StatusCode , "non-existent OTP didn't return 400 " )
241+ assert .NotEqual (t , http .StatusOK , r .StatusCode , "non-existent OTP didn't return 200 " )
242242
243- // Check non-existent OTP, should return store.ErrNotExist error message.
244- _ = testRequest (t , http .MethodPost , "/api/otp/abc123" , cp , & out )
245- assert .Equal (t , "the OTP does not exist" , out .Message , "non-existent OTP passed" )
243+ // Check non-existent OTP, should return 410.
244+ r = testRequest (t , http .MethodPost , "/api/otp/abc123" , cp , & out )
245+ assert .Equal (t , http .StatusGone , r .StatusCode , "non-existent OTP returns 410" )
246+ assert .Equal (t , "OTP has expired or doesn't exist" , out .Message , "non-existent OTP passed" )
246247}
247248
248249func TestCheckOTPAttempts (t * testing.T ) {
@@ -322,8 +323,9 @@ func TestDeleteOnOTPCheck(t *testing.T) {
322323 assert .Equal (t , http .StatusOK , r .StatusCode , "verification pending" )
323324
324325 // Reattempt status check
325- r = testRequest (t , http .MethodDelete , "/api/otp/" + dummyOTPID + "/status" , nil , & data )
326- assert .Equal (t , http .StatusBadRequest , r .StatusCode , "otp not found" )
326+ r = testRequest (t , http .MethodDelete , "/api/otp/" + dummyOTPID + "/status" , nil , & out )
327+ assert .Equal (t , http .StatusGone , r .StatusCode , "otp not found returns 410" )
328+ assert .Equal (t , "OTP has expired or doesn't exist" , out .Message , "deleted OTP passed" )
327329}
328330
329331func testRequest (t * testing.T , method , path string , p url.Values , out interface {}) * http.Response {
0 commit comments