Commit 4f3a7bb0 by Emil Hessman Committed by GitHub

Chore: Rewrite models dashboard acl test to standard library (#30022)

parent 8e1196e3
package models
import (
"testing"
"fmt"
"testing"
. "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())
})
})
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment