Nested folders: Refactor folder update (#60323)

* Nested folders: Refactor folder update

* Apply suggestions from code review
This commit is contained in:
Sofia Papagiannaki
2022-12-20 15:00:33 +02:00
committed by GitHub
parent 5d4e35c3d5
commit 55b014974d
15 changed files with 267 additions and 148 deletions
+7 -5
View File
@@ -90,8 +90,9 @@ func TestFoldersAPIEndpoint(t *testing.T) {
})
t.Run("Given a correct request for updating a folder", func(t *testing.T) {
cmd := models.UpdateFolderCommand{
Title: "Folder upd",
title := "Folder upd"
cmd := folder.UpdateFolderCommand{
NewTitle: &title,
}
folderService.ExpectedFolder = &folder.Folder{ID: 1, UID: "uid", Title: "Folder upd"}
@@ -125,8 +126,9 @@ func TestFoldersAPIEndpoint(t *testing.T) {
{Error: dashboards.ErrFolderFailedGenerateUniqueUid, ExpectedStatusCode: 500},
}
cmd := models.UpdateFolderCommand{
Title: "Folder upd",
title := "Folder upd"
cmd := folder.UpdateFolderCommand{
NewTitle: &title,
}
for _, tc := range testCases {
@@ -278,7 +280,7 @@ func callUpdateFolder(sc *scenarioContext) {
}
func updateFolderScenario(t *testing.T, desc string, url string, routePattern string, folderService folder.Service,
cmd models.UpdateFolderCommand, fn scenarioFunc) {
cmd folder.UpdateFolderCommand, fn scenarioFunc) {
setUpRBACGuardian(t)
t.Run(fmt.Sprintf("%s %s", desc, url), func(t *testing.T) {
hs := HTTPServer{