Chore: Add CloudWatch HTTP API tests (#29691)

* CloudWatch: Add HTTP API tests

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
Arve Knudsen
2021-01-07 11:36:13 +01:00
committed by GitHub
parent b6efebd92c
commit 25048ebdf8
33 changed files with 1286 additions and 191 deletions
+3 -4
View File
@@ -22,16 +22,15 @@ func GetOrgByID(c *models.ReqContext) Response {
}
// Get /api/orgs/name/:name
func GetOrgByName(c *models.ReqContext) Response {
query := models.GetOrgByNameQuery{Name: c.Params(":name")}
if err := bus.Dispatch(&query); err != nil {
func (hs *HTTPServer) GetOrgByName(c *models.ReqContext) Response {
org, err := hs.SQLStore.GetOrgByName(c.Params(":name"))
if err != nil {
if errors.Is(err, models.ErrOrgNotFound) {
return Error(404, "Organization not found", err)
}
return Error(500, "Failed to get organization", err)
}
org := query.Result
result := models.OrgDetailsDTO{
Id: org.Id,
Name: org.Name,