Add more unit tests for removeSSOSettings method (#78329)

* add more unit tests for remove sso settings

* add unit tests for the service method
This commit is contained in:
Mihai Doarna
2023-11-21 10:11:52 +02:00
committed by GitHub
parent 7f7d912af7
commit 875ea092df
4 changed files with 143 additions and 25 deletions
+4
View File
@@ -1,6 +1,7 @@
package api
import (
"errors"
"net/http"
"github.com/grafana/grafana/pkg/api/response"
@@ -121,6 +122,9 @@ func (api *Api) removeProviderSettings(c *contextmodel.ReqContext) response.Resp
err := api.SSOSettingsService.Delete(c.Req.Context(), key)
if err != nil {
if errors.Is(err, ssosettings.ErrNotFound) {
return response.Error(http.StatusNotFound, "The provider was not found", err)
}
return response.Error(http.StatusInternalServerError, "Failed to delete provider settings", err)
}