From 4f3a7bb0fad511a9187d89a60ceb6116a7887fc2 Mon Sep 17 00:00:00 2001 From: Emil Hessman Date: Fri, 1 Jan 2021 13:22:48 +0100 Subject: [PATCH] Chore: Rewrite models dashboard acl test to standard library (#30022) --- pkg/models/dashboard_acl_test.go | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/pkg/models/dashboard_acl_test.go b/pkg/models/dashboard_acl_test.go index 220701f89de..f02b132fb9e 100644 --- a/pkg/models/dashboard_acl_test.go +++ b/pkg/models/dashboard_acl_test.go @@ -1,20 +1,26 @@ package models import ( + "fmt" "testing" - "fmt" - - . "github.com/smartystreets/goconvey/convey" + "github.com/stretchr/testify/assert" ) -func TestDashboardAclModel(t *testing.T) { - Convey("When printing a PermissionType", t, func() { - view := PERMISSION_VIEW - printed := fmt.Sprint(view) +func TestPermissionType_String(t *testing.T) { + testCases := []struct { + permissionType PermissionType + expected string + }{ + {PERMISSION_ADMIN, "Admin"}, + {PERMISSION_EDIT, "Edit"}, + {PERMISSION_VIEW, "View"}, + } - Convey("Should output a friendly name", func() { - So(printed, ShouldEqual, "View") + for _, tc := range testCases { + t.Run(tc.expected, func(t *testing.T) { + assert.Equal(t, tc.expected, fmt.Sprint(tc.permissionType)) + assert.Equal(t, tc.expected, tc.permissionType.String()) }) - }) + } }