[MM-19473] Fix data race on user login (#12870)

* Avoid writes to App.Session outside the app layer

* Fix merge

* Remove unneeded else condition
Этот коммит содержится в:
Claudio Costa
2019-10-31 12:50:43 +01:00
коммит произвёл GitHub
родитель 6f6eb13a47
Коммит 422f377c96
6 изменённых файлов: 65 добавлений и 65 удалений

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

@@ -694,7 +694,7 @@ func TestUserWillLogIn_Blocked(t *testing.T) {
r := &http.Request{}
w := httptest.NewRecorder()
_, err = th.App.DoLogin(w, r, th.BasicUser, "")
err = th.App.DoLogin(w, r, th.BasicUser, "")
assert.Contains(t, err.Id, "Login rejected by plugin", "Expected Login rejected by plugin, got %s", err.Id)
}
@@ -733,10 +733,10 @@ func TestUserWillLogInIn_Passed(t *testing.T) {
r := &http.Request{}
w := httptest.NewRecorder()
session, err := th.App.DoLogin(w, r, th.BasicUser, "")
err = th.App.DoLogin(w, r, th.BasicUser, "")
assert.Nil(t, err, "Expected nil, got %s", err)
assert.Equal(t, session.UserId, th.BasicUser.Id)
assert.Equal(t, th.App.Session.UserId, th.BasicUser.Id)
}
func TestUserHasLoggedIn(t *testing.T) {
@@ -774,7 +774,7 @@ func TestUserHasLoggedIn(t *testing.T) {
r := &http.Request{}
w := httptest.NewRecorder()
_, err = th.App.DoLogin(w, r, th.BasicUser, "")
err = th.App.DoLogin(w, r, th.BasicUser, "")
assert.Nil(t, err, "Expected nil, got %s", err)