1
0

Add link share password authentication (#831)

Reviewed-on: https://kolaente.dev/vikunja/api/pulls/831
Co-authored-by: konrad <konrad@kola-entertainments.de>
Co-committed-by: konrad <konrad@kola-entertainments.de>
This commit is contained in:
konrad
2021-04-11 13:17:50 +00:00
parent 6a927c0703
commit b3c604fd2f
20 changed files with 471 additions and 40 deletions

View File

@ -31,12 +31,12 @@ func TestUserPasswordReset(t *testing.T) {
rec, err := newTestRequest(t, http.MethodPost, apiv1.UserResetPassword, `{
"new_password": "1234",
"token": "passwordresettesttoken"
}`)
}`, nil, nil)
assert.NoError(t, err)
assert.Contains(t, rec.Body.String(), `The password was updated successfully.`)
})
t.Run("Empty payload", func(t *testing.T) {
_, err := newTestRequest(t, http.MethodPost, apiv1.UserResetPassword, `{}`)
_, err := newTestRequest(t, http.MethodPost, apiv1.UserResetPassword, `{}`, nil, nil)
assert.Error(t, err)
assert.Equal(t, http.StatusBadRequest, err.(*echo.HTTPError).Code)
})
@ -44,7 +44,7 @@ func TestUserPasswordReset(t *testing.T) {
_, err := newTestRequest(t, http.MethodPost, apiv1.UserResetPassword, `{
"new_password": "",
"token": "passwordresettesttoken"
}`)
}`, nil, nil)
assert.Error(t, err)
assertHandlerErrorCode(t, err, user.ErrCodeNoUsernamePassword)
})
@ -52,7 +52,7 @@ func TestUserPasswordReset(t *testing.T) {
_, err := newTestRequest(t, http.MethodPost, apiv1.UserResetPassword, `{
"new_password": "1234",
"token": "invalidtoken"
}`)
}`, nil, nil)
assert.Error(t, err)
assertHandlerErrorCode(t, err, user.ErrCodeInvalidPasswordResetToken)
})