Cache test users to speed up testing (#13741)

* Cache test users to speed up testing

Users were recreated for many tests and hashing passwords takes a lot of
time. Testing /api4 takes around 120s less and /app 60s less.

* fix build

* simplifying a bit the approach

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Jesús Espino <jespinog@gmail.com>
Этот коммит содержится в:
Patryk Pomykalski
2020-03-03 14:19:54 +01:00
коммит произвёл GitHub
родитель 89f4e9d7ef
Коммит 662eef6881
4 изменённых файлов: 78 добавлений и 13 удалений

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

@@ -18,7 +18,10 @@ func TestGetPreferences(t *testing.T) {
defer th.TearDown()
Client := th.Client
// recreate basic user (cached has no default preferences)
th.BasicUser = th.CreateUser()
th.LoginBasic()
user1 := th.BasicUser
category := model.NewId()
@@ -50,6 +53,8 @@ func TestGetPreferences(t *testing.T) {
require.Equal(t, preference.UserId, th.BasicUser.Id, "user id does not match")
}
// recreate basic user2
th.BasicUser2 = th.CreateUser()
th.LoginBasic2()
prefs, resp = Client.GetPreferences(th.BasicUser2.Id)