Folders: reenable unit tests (#107751)
* Folders: reenable unit test TestFoldersCreateAPIEndpointK8S Signed-off-by: Maicon Costa <maiconscosta@gmail.com> * reenable unit test TestFoldersGetAPIEndpointK8S Signed-off-by: Maicon Costa <maiconscosta@gmail.com> --------- Signed-off-by: Maicon Costa <maiconscosta@gmail.com>
This commit is contained in:
@@ -862,10 +862,6 @@ func TestIntegrationFolderGetPermissions(t *testing.T) {
|
||||
|
||||
// TestFoldersCreateAPIEndpointK8S is the counterpart of pkg/api/folder_test.go TestFoldersCreateAPIEndpoint
|
||||
func TestFoldersCreateAPIEndpointK8S(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
|
||||
folderWithoutParentInput := "{ \"uid\": \"uid\", \"title\": \"Folder\"}"
|
||||
folderWithTitleEmpty := "{ \"title\": \"\"}"
|
||||
folderWithInvalidUid := "{ \"uid\": \"::::::::::::\", \"title\": \"Another folder\"}"
|
||||
@@ -902,7 +898,7 @@ func TestFoldersCreateAPIEndpointK8S(t *testing.T) {
|
||||
description: "folder creation fails without permissions to create a folder",
|
||||
input: folderWithoutParentInput,
|
||||
expectedCode: http.StatusForbidden,
|
||||
expectedMessage: dashboards.ErrFolderAccessDenied.Error(),
|
||||
expectedMessage: fmt.Sprintf("You'll need additional permissions to perform this action. Permissions needed: %s", "folders:create"),
|
||||
permissions: []resourcepermissions.SetResourcePermissionCommand{},
|
||||
},
|
||||
{
|
||||
@@ -1023,10 +1019,6 @@ func testDescription(description string, expectedErr error) string {
|
||||
|
||||
// There are no counterpart of TestFoldersGetAPIEndpointK8S in pkg/api/folder_test.go
|
||||
func TestFoldersGetAPIEndpointK8S(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
|
||||
type testCase struct {
|
||||
description string
|
||||
expectedCode int
|
||||
@@ -1062,6 +1054,7 @@ func TestFoldersGetAPIEndpointK8S(t *testing.T) {
|
||||
expectedOutput: []dtos.FolderSearchHit{
|
||||
{UID: "foo", Title: "Folder 1"},
|
||||
{UID: "qux", Title: "Folder 3"},
|
||||
{UID: folder.SharedWithMeFolder.UID, Title: folder.SharedWithMeFolder.Title},
|
||||
},
|
||||
permissions: folderReadAndCreatePermission,
|
||||
},
|
||||
@@ -1107,7 +1100,7 @@ func TestFoldersGetAPIEndpointK8S(t *testing.T) {
|
||||
}
|
||||
|
||||
// test on all dualwriter modes
|
||||
for mode := 1; mode <= 4; mode++ {
|
||||
for mode := 0; mode <= 4; mode++ {
|
||||
for _, tc := range tcs {
|
||||
t.Run(fmt.Sprintf("Mode: %d, %s", mode, tc.description), func(t *testing.T) {
|
||||
modeDw := grafanarest.DualWriterMode(mode)
|
||||
@@ -1123,6 +1116,7 @@ func TestFoldersGetAPIEndpointK8S(t *testing.T) {
|
||||
},
|
||||
EnableFeatureToggles: []string{
|
||||
featuremgmt.FlagNestedFolders,
|
||||
featuremgmt.FlagUnifiedStorageSearch,
|
||||
featuremgmt.FlagKubernetesClientDashboardsFolders,
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user