* api4: fix TestGetUsersNotInTeam assertions

This test was relying on data from a previous test run. With the data cleared before each test, the assertions much match reality.

* *testlib: always InitSystemAdmin

Some tests implicitly relied on the basic user having system
administrator privileges because it was the first user created as such.
Eliminate `InitSystemAdmin` and explicitly create the system admin user
instead to avoid this ambiguity going forward.

* *testlib: drop all tables before each test

* api4: split up TestChannelDelete to avoid duplicate InitBasic

* api4: teardown in TestResetPassword, for when this test comes back

* invalidate cache on DropAllTables

This is necessary since the test store persists across tests.

* disable parallel tests

While tests within a package must be explicitly parallelized using `t.Parallel()`, tests across packages are run in parallel by default.  This causes problems given that the tests all currently share the same database instance.

Unfortunately, this also means that running the tests is much slower, but we can return to this later.
Этот коммит содержится в:
Jesse Hallam
2018-11-20 20:16:25 -05:00
коммит произвёл Joram Wilander
родитель 2555a5d45d
Коммит a78913178c
35 изменённых файлов: 271 добавлений и 327 удалений

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

@@ -23,7 +23,7 @@ import (
)
func TestCreateOAuthApp(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
th := Setup().InitBasic()
defer th.TearDown()
Client := th.Client
AdminClient := th.SystemAdminClient
@@ -96,7 +96,7 @@ func TestCreateOAuthApp(t *testing.T) {
}
func TestUpdateOAuthApp(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
th := Setup().InitBasic()
defer th.TearDown()
Client := th.Client
AdminClient := th.SystemAdminClient
@@ -213,7 +213,7 @@ func TestUpdateOAuthApp(t *testing.T) {
}
func TestGetOAuthApps(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
th := Setup().InitBasic()
defer th.TearDown()
Client := th.Client
AdminClient := th.SystemAdminClient
@@ -287,7 +287,7 @@ func TestGetOAuthApps(t *testing.T) {
}
func TestGetOAuthApp(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
th := Setup().InitBasic()
defer th.TearDown()
Client := th.Client
AdminClient := th.SystemAdminClient
@@ -363,7 +363,7 @@ func TestGetOAuthApp(t *testing.T) {
}
func TestGetOAuthAppInfo(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
th := Setup().InitBasic()
defer th.TearDown()
Client := th.Client
AdminClient := th.SystemAdminClient
@@ -439,7 +439,7 @@ func TestGetOAuthAppInfo(t *testing.T) {
}
func TestDeleteOAuthApp(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
th := Setup().InitBasic()
defer th.TearDown()
Client := th.Client
AdminClient := th.SystemAdminClient
@@ -509,7 +509,7 @@ func TestDeleteOAuthApp(t *testing.T) {
}
func TestRegenerateOAuthAppSecret(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
th := Setup().InitBasic()
defer th.TearDown()
Client := th.Client
AdminClient := th.SystemAdminClient
@@ -583,7 +583,7 @@ func TestRegenerateOAuthAppSecret(t *testing.T) {
}
func TestGetAuthorizedOAuthAppsForUser(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
th := Setup().InitBasic()
defer th.TearDown()
Client := th.Client
AdminClient := th.SystemAdminClient
@@ -643,7 +643,7 @@ func TestGetAuthorizedOAuthAppsForUser(t *testing.T) {
}
func TestAuthorizeOAuthApp(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
th := Setup().InitBasic()
defer th.TearDown()
Client := th.Client
AdminClient := th.SystemAdminClient
@@ -732,7 +732,7 @@ func TestAuthorizeOAuthApp(t *testing.T) {
}
func TestDeauthorizeOAuthApp(t *testing.T) {
th := Setup().InitBasic().InitSystemAdmin()
th := Setup().InitBasic()
defer th.TearDown()
Client := th.Client
AdminClient := th.SystemAdminClient