MM-26750: Remove instances of InitBasic when it's not required (#14984)

th.InitBasic initializes users, channels, and teams. But a lot of
tests don't use it at all, causing unncessary delays. A single InitBasic
call takes around 400ms. This PR removes 71 of them, approximately shaving
off 28 seconds. Arguably, this would be more because some tests run in loops.
Этот коммит содержится в:
Agniva De Sarker
2020-07-13 23:04:05 +05:30
коммит произвёл GitHub
родитель da95d40e33
Коммит 94827d06a3
25 изменённых файлов: 86 добавлений и 84 удалений

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

@@ -14,7 +14,7 @@ import (
)
func TestCache(t *testing.T) {
th := Setup(t).InitBasic()
th := Setup(t)
defer th.TearDown()
session := &model.Session{
@@ -51,7 +51,7 @@ func TestCache(t *testing.T) {
}
func TestGetSessionIdleTimeoutInMinutes(t *testing.T) {
th := Setup(t).InitBasic()
th := Setup(t)
defer th.TearDown()
session := &model.Session{
@@ -187,7 +187,7 @@ const hourMillis int64 = 60 * 60 * 1000
const dayMillis int64 = 24 * hourMillis
func TestApp_GetSessionLengthInMillis(t *testing.T) {
th := Setup(t).InitBasic()
th := Setup(t)
defer th.TearDown()
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.SessionLengthMobileInDays = 3 })
@@ -273,7 +273,7 @@ func TestApp_GetSessionLengthInMillis(t *testing.T) {
}
func TestApp_ExtendExpiryIfNeeded(t *testing.T) {
th := Setup(t).InitBasic()
th := Setup(t)
defer th.TearDown()
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ExtendSessionLengthWithActivity = true })