TokenStore migration to return plain errors (#14875)

* TokenStore migration to return plain errors

* Fix translations

* Fix: returned error is ignored and http.StatusBadRequest is always returned

* Fix

* Fix translations

* Suggestions

* Changed from BadRequest to NotFound

* Setting the correct http status

* Changed test to expect 404 status

* Fix error
Этот коммит содержится в:
Rodrigo Villablanca
2020-07-09 03:16:27 -04:00
коммит произвёл GitHub
родитель 4df6019f61
Коммит 8b6a5fc5d7
14 изменённых файлов: 101 добавлений и 86 удалений

Просмотреть файл

@@ -256,8 +256,8 @@ func TestAddUserToTeamByToken(t *testing.T) {
_, err := th.App.AddUserToTeamByToken(ruser.Id, token.Token)
require.Nil(t, err, "Should add user to the team")
_, err = th.App.Srv().Store.Token().GetByToken(token.Token)
require.NotNil(t, err, "The token must be deleted after be used")
_, nErr := th.App.Srv().Store.Token().GetByToken(token.Token)
require.NotNil(t, nErr, "The token must be deleted after be used")
members, err := th.App.GetChannelMembersForUser(th.BasicTeam.Id, ruser.Id)
require.Nil(t, err)
@@ -356,8 +356,8 @@ func TestAddUserToTeamByToken(t *testing.T) {
_, err := th.App.AddUserToTeamByToken(rguest.Id, token.Token)
require.Nil(t, err, "Should add user to the team")
_, err = th.App.Srv().Store.Token().GetByToken(token.Token)
require.NotNil(t, err, "The token must be deleted after be used")
_, nErr := th.App.Srv().Store.Token().GetByToken(token.Token)
require.NotNil(t, nErr, "The token must be deleted after be used")
members, err := th.App.GetChannelMembersForUser(th.BasicTeam.Id, rguest.Id)
require.Nil(t, err)