From 5826bf42fd507a5f994304a9b70b4a3e38078319 Mon Sep 17 00:00:00 2001 From: Todd Knight Date: Thu, 16 Jul 2020 10:54:24 -0700 Subject: [PATCH] Fixing api test cases. (#201) --- api/groups/group_test.go | 6 +++--- api/hosts/host_catalog_test.go | 4 ++-- api/scopes/authenticate_test.go | 4 ++-- api/scopes/project_test.go | 6 +++--- api/users/user_test.go | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/api/groups/group_test.go b/api/groups/group_test.go index d19904539..5eaabc884 100644 --- a/api/groups/group_test.go +++ b/api/groups/group_test.go @@ -25,7 +25,7 @@ type groupCrud interface { func TestGroup_List(t *testing.T) { assert := assert.New(t) - tc := controller.NewTestController(t, nil) + tc := controller.NewTestController(t, &controller.TestControllerOpts{DisableAuthorizationFailures: true}) defer tc.Shutdown() client := tc.Client() @@ -101,7 +101,7 @@ func comparableSlice(in []*groups.Group) []groups.Group { } func TestGroup_Crud(t *testing.T) { - tc := controller.NewTestController(t, nil) + tc := controller.NewTestController(t, &controller.TestControllerOpts{DisableAuthorizationFailures: true}) defer tc.Shutdown() client := tc.Client() @@ -174,7 +174,7 @@ func TestGroup_Crud(t *testing.T) { func TestGroup_Errors(t *testing.T) { assert := assert.New(t) - tc := controller.NewTestController(t, nil) + tc := controller.NewTestController(t, &controller.TestControllerOpts{DisableAuthorizationFailures: true}) defer tc.Shutdown() ctx := tc.Context() diff --git a/api/hosts/host_catalog_test.go b/api/hosts/host_catalog_test.go index d11f838ca..c603c23cd 100644 --- a/api/hosts/host_catalog_test.go +++ b/api/hosts/host_catalog_test.go @@ -14,7 +14,7 @@ import ( ) func TestCatalogs_Crud(t *testing.T) { - tc := controller.NewTestController(t, nil) + tc := controller.NewTestController(t, &controller.TestControllerOpts{DisableAuthorizationFailures: true}) defer tc.Shutdown() client := tc.Client() @@ -68,7 +68,7 @@ func TestCatalogs_Crud(t *testing.T) { // TODO: Get better coverage for expected errors and error formats. func TestCatalogs_Errors(t *testing.T) { assert := assert.New(t) - tc := controller.NewTestController(t, nil) + tc := controller.NewTestController(t, &controller.TestControllerOpts{DisableAuthorizationFailures: true}) defer tc.Shutdown() ctx := tc.Context() diff --git a/api/scopes/authenticate_test.go b/api/scopes/authenticate_test.go index e6f879672..90aca8f1b 100644 --- a/api/scopes/authenticate_test.go +++ b/api/scopes/authenticate_test.go @@ -22,12 +22,12 @@ func TestAuthenticate(t *testing.T) { } ctx := context.Background() - tok, apiErr, err := org.Authenticate(ctx, "am_anything", "admin", "hunter2") + tok, apiErr, err := org.Authenticate(ctx, "am_1234567890", "admin", "hunter2") assert.NoError(err) assert.Nil(apiErr) assert.NotNil(tok) - _, apiErr, err = org.Authenticate(ctx, "am_anything", "wrong", "wrong") + _, apiErr, err = org.Authenticate(ctx, "am_1234567890", "wrong", "wrong") assert.NoError(err) require.NotNil(t, apiErr) assert.EqualValuesf(http.StatusUnauthorized, apiErr.Status, "Expected unauthenticated, got %q", apiErr.Message) diff --git a/api/scopes/project_test.go b/api/scopes/project_test.go index fbcb41992..2d729b64d 100644 --- a/api/scopes/project_test.go +++ b/api/scopes/project_test.go @@ -14,7 +14,7 @@ import ( func TestProjects_List(t *testing.T) { assert := assert.New(t) - tc := controller.NewTestController(t, nil) + tc := controller.NewTestController(t, &controller.TestControllerOpts{DisableAuthorizationFailures: true}) defer tc.Shutdown() client := tc.Client() @@ -68,7 +68,7 @@ func comparableSlice(in []*scopes.Project) []scopes.Project { } func TestProjects_Crud(t *testing.T) { - tc := controller.NewTestController(t, nil) + tc := controller.NewTestController(t, &controller.TestControllerOpts{DisableAuthorizationFailures: true}) defer tc.Shutdown() client := tc.Client() @@ -116,7 +116,7 @@ func TestProjects_Crud(t *testing.T) { // TODO: Get better coverage for expected errors and error formats. func TestProject_Errors(t *testing.T) { assert := assert.New(t) - tc := controller.NewTestController(t, nil) + tc := controller.NewTestController(t, &controller.TestControllerOpts{DisableAuthorizationFailures: true}) defer tc.Shutdown() ctx := tc.Context() diff --git a/api/users/user_test.go b/api/users/user_test.go index 0837ac36a..c0647d0ec 100644 --- a/api/users/user_test.go +++ b/api/users/user_test.go @@ -17,7 +17,7 @@ import ( func TestUsers_List(t *testing.T) { assert := assert.New(t) - tc := controller.NewTestController(t, nil) + tc := controller.NewTestController(t, &controller.TestControllerOpts{DisableAuthorizationFailures: true}) defer tc.Shutdown() client := tc.Client() @@ -73,7 +73,7 @@ func comparableSlice(in []*users.User) []users.User { } func TestUser_Crud(t *testing.T) { - tc := controller.NewTestController(t, nil) + tc := controller.NewTestController(t, &controller.TestControllerOpts{DisableAuthorizationFailures: true}) defer tc.Shutdown() client := tc.Client() @@ -124,7 +124,7 @@ func TestUser_Crud(t *testing.T) { func TestUser_Errors(t *testing.T) { assert := assert.New(t) - tc := controller.NewTestController(t, nil) + tc := controller.NewTestController(t, &controller.TestControllerOpts{DisableAuthorizationFailures: true}) defer tc.Shutdown() ctx := tc.Context()