PublicDashboards: Remove publicDashboards FF (#96578)

This commit is contained in:
Juan Cabanas
2024-11-20 11:36:19 -03:00
committed by GitHub
parent 9f53362e3c
commit b8e92aacd2
19 changed files with 78 additions and 121 deletions
+6 -13
View File
@@ -74,14 +74,7 @@ func TestAPIFeatureDisabled(t *testing.T) {
cfg := setting.NewCfg()
cfg.PublicDashboardsEnabled = false
service := publicdashboards.NewFakePublicDashboardService(t)
testServer := setupTestServer(t, cfg, service, userAdmin, true)
response := callAPI(testServer, test.Method, test.Path, nil, t)
assert.Equal(t, http.StatusNotFound, response.Code)
})
t.Run(test.Name+" - feature flag disabled", func(t *testing.T) {
service := publicdashboards.NewFakePublicDashboardService(t)
testServer := setupTestServer(t, nil, service, userAdmin, false)
testServer := setupTestServer(t, cfg, service, userAdmin)
response := callAPI(testServer, test.Method, test.Path, nil, t)
assert.Equal(t, http.StatusNotFound, response.Code)
})
@@ -136,7 +129,7 @@ func TestAPIListPublicDashboard(t *testing.T) {
service.On("FindAllWithPagination", mock.Anything, mock.Anything, mock.Anything).
Return(test.Response, test.ResponseErr).Maybe()
testServer := setupTestServer(t, nil, service, test.User, true)
testServer := setupTestServer(t, nil, service, test.User)
response := callAPI(testServer, http.MethodGet, "/api/dashboards/public-dashboards", nil, t)
assert.Equal(t, test.ExpectedHttpResponse, response.Code)
@@ -263,7 +256,7 @@ func TestAPIDeletePublicDashboard(t *testing.T) {
Return(test.ResponseErr)
}
testServer := setupTestServer(t, nil, service, test.User, true)
testServer := setupTestServer(t, nil, service, test.User)
response := callAPI(testServer, http.MethodDelete, fmt.Sprintf("/api/dashboards/uid/%s/public-dashboards/%s", test.DashboardUid, test.PublicDashboardUid), nil, t)
assert.Equal(t, test.ExpectedHttpResponse, response.Code)
@@ -345,7 +338,7 @@ func TestAPIGetPublicDashboard(t *testing.T) {
Return(test.PublicDashboardResult, test.PublicDashboardErr)
}
testServer := setupTestServer(t, nil, service, test.User, true)
testServer := setupTestServer(t, nil, service, test.User)
response := callAPI(
testServer,
@@ -463,7 +456,7 @@ func TestApiCreatePublicDashboard(t *testing.T) {
Return(&PublicDashboard{IsEnabled: true}, test.SaveDashboardErr)
}
testServer := setupTestServer(t, nil, service, test.User, true)
testServer := setupTestServer(t, nil, service, test.User)
response := callAPI(
testServer,
@@ -597,7 +590,7 @@ func TestAPIUpdatePublicDashboard(t *testing.T) {
Return(test.ExpectedResponse, test.ExpectedError)
}
testServer := setupTestServer(t, nil, service, test.User, true)
testServer := setupTestServer(t, nil, service, test.User)
url := fmt.Sprintf("/api/dashboards/uid/%s/public-dashboards/%s", test.DashboardUid, test.PublicDashboardUid)
body := strings.NewReader(test.Body)