Library elements: Delete orphaned connections with the dashboard service (#99612)

This commit is contained in:
Stephanie Hingtgen
2025-01-27 22:37:38 +02:00
committed by GitHub
parent 82f457495a
commit 078ce6a289
3 changed files with 41 additions and 13 deletions
@@ -82,4 +82,14 @@ func TestDeleteLibraryElement(t *testing.T) {
resp := sc.service.deleteHandler(sc.reqContext)
require.Equal(t, 403, resp.Status())
})
scenarioWithPanel(t, "When an admin tries to delete a library panel that is connected to a non-existent dashboard, it should succeed",
func(t *testing.T, sc scenarioContext) {
err := sc.service.ConnectElementsToDashboard(sc.reqContext.Req.Context(), sc.reqContext.SignedInUser, []string{sc.initialResult.Result.UID}, 9999999)
require.NoError(t, err)
sc.ctx.Req = web.SetURLParams(sc.ctx.Req, map[string]string{":uid": sc.initialResult.Result.UID})
resp := sc.service.deleteHandler(sc.reqContext)
require.Equal(t, 200, resp.Status())
})
}