|
@@ -14,17 +14,15 @@ import (
|
|
|
func TestAnnotationsApiEndpoint(t *testing.T) {
|
|
func TestAnnotationsApiEndpoint(t *testing.T) {
|
|
|
Convey("Given an annotation without a dashboard id", t, func() {
|
|
Convey("Given an annotation without a dashboard id", t, func() {
|
|
|
cmd := dtos.PostAnnotationsCmd{
|
|
cmd := dtos.PostAnnotationsCmd{
|
|
|
- Time: 1000,
|
|
|
|
|
- Text: "annotation text",
|
|
|
|
|
- Tags: []string{"tag1", "tag2"},
|
|
|
|
|
- IsRegion: false,
|
|
|
|
|
|
|
+ Time: 1000,
|
|
|
|
|
+ Text: "annotation text",
|
|
|
|
|
+ Tags: []string{"tag1", "tag2"},
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
updateCmd := dtos.UpdateAnnotationsCmd{
|
|
updateCmd := dtos.UpdateAnnotationsCmd{
|
|
|
- Time: 1000,
|
|
|
|
|
- Text: "annotation text",
|
|
|
|
|
- Tags: []string{"tag1", "tag2"},
|
|
|
|
|
- IsRegion: false,
|
|
|
|
|
|
|
+ Time: 1000,
|
|
|
|
|
+ Text: "annotation text",
|
|
|
|
|
+ Tags: []string{"tag1", "tag2"},
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
patchCmd := dtos.PatchAnnotationsCmd{
|
|
patchCmd := dtos.PatchAnnotationsCmd{
|
|
@@ -56,12 +54,6 @@ func TestAnnotationsApiEndpoint(t *testing.T) {
|
|
|
sc.fakeReqWithParams("DELETE", sc.url, map[string]string{}).exec()
|
|
sc.fakeReqWithParams("DELETE", sc.url, map[string]string{}).exec()
|
|
|
So(sc.resp.Code, ShouldEqual, 403)
|
|
So(sc.resp.Code, ShouldEqual, 403)
|
|
|
})
|
|
})
|
|
|
-
|
|
|
|
|
- loggedInUserScenarioWithRole("When calling DELETE on", "DELETE", "/api/annotations/region/1", "/api/annotations/region/:regionId", role, func(sc *scenarioContext) {
|
|
|
|
|
- sc.handlerFunc = DeleteAnnotationRegion
|
|
|
|
|
- sc.fakeReqWithParams("DELETE", sc.url, map[string]string{}).exec()
|
|
|
|
|
- So(sc.resp.Code, ShouldEqual, 403)
|
|
|
|
|
- })
|
|
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -88,12 +80,6 @@ func TestAnnotationsApiEndpoint(t *testing.T) {
|
|
|
sc.fakeReqWithParams("DELETE", sc.url, map[string]string{}).exec()
|
|
sc.fakeReqWithParams("DELETE", sc.url, map[string]string{}).exec()
|
|
|
So(sc.resp.Code, ShouldEqual, 200)
|
|
So(sc.resp.Code, ShouldEqual, 200)
|
|
|
})
|
|
})
|
|
|
-
|
|
|
|
|
- loggedInUserScenarioWithRole("When calling DELETE on", "DELETE", "/api/annotations/region/1", "/api/annotations/region/:regionId", role, func(sc *scenarioContext) {
|
|
|
|
|
- sc.handlerFunc = DeleteAnnotationRegion
|
|
|
|
|
- sc.fakeReqWithParams("DELETE", sc.url, map[string]string{}).exec()
|
|
|
|
|
- So(sc.resp.Code, ShouldEqual, 200)
|
|
|
|
|
- })
|
|
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
@@ -103,17 +89,15 @@ func TestAnnotationsApiEndpoint(t *testing.T) {
|
|
|
Time: 1000,
|
|
Time: 1000,
|
|
|
Text: "annotation text",
|
|
Text: "annotation text",
|
|
|
Tags: []string{"tag1", "tag2"},
|
|
Tags: []string{"tag1", "tag2"},
|
|
|
- IsRegion: false,
|
|
|
|
|
DashboardId: 1,
|
|
DashboardId: 1,
|
|
|
PanelId: 1,
|
|
PanelId: 1,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
updateCmd := dtos.UpdateAnnotationsCmd{
|
|
updateCmd := dtos.UpdateAnnotationsCmd{
|
|
|
- Time: 1000,
|
|
|
|
|
- Text: "annotation text",
|
|
|
|
|
- Tags: []string{"tag1", "tag2"},
|
|
|
|
|
- IsRegion: false,
|
|
|
|
|
- Id: 1,
|
|
|
|
|
|
|
+ Time: 1000,
|
|
|
|
|
+ Text: "annotation text",
|
|
|
|
|
+ Tags: []string{"tag1", "tag2"},
|
|
|
|
|
+ Id: 1,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
patchCmd := dtos.PatchAnnotationsCmd{
|
|
patchCmd := dtos.PatchAnnotationsCmd{
|
|
@@ -169,12 +153,6 @@ func TestAnnotationsApiEndpoint(t *testing.T) {
|
|
|
sc.fakeReqWithParams("DELETE", sc.url, map[string]string{}).exec()
|
|
sc.fakeReqWithParams("DELETE", sc.url, map[string]string{}).exec()
|
|
|
So(sc.resp.Code, ShouldEqual, 403)
|
|
So(sc.resp.Code, ShouldEqual, 403)
|
|
|
})
|
|
})
|
|
|
-
|
|
|
|
|
- loggedInUserScenarioWithRole("When calling DELETE on", "DELETE", "/api/annotations/region/1", "/api/annotations/region/:regionId", role, func(sc *scenarioContext) {
|
|
|
|
|
- sc.handlerFunc = DeleteAnnotationRegion
|
|
|
|
|
- sc.fakeReqWithParams("DELETE", sc.url, map[string]string{}).exec()
|
|
|
|
|
- So(sc.resp.Code, ShouldEqual, 403)
|
|
|
|
|
- })
|
|
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -201,12 +179,6 @@ func TestAnnotationsApiEndpoint(t *testing.T) {
|
|
|
sc.fakeReqWithParams("DELETE", sc.url, map[string]string{}).exec()
|
|
sc.fakeReqWithParams("DELETE", sc.url, map[string]string{}).exec()
|
|
|
So(sc.resp.Code, ShouldEqual, 200)
|
|
So(sc.resp.Code, ShouldEqual, 200)
|
|
|
})
|
|
})
|
|
|
-
|
|
|
|
|
- loggedInUserScenarioWithRole("When calling DELETE on", "DELETE", "/api/annotations/region/1", "/api/annotations/region/:regionId", role, func(sc *scenarioContext) {
|
|
|
|
|
- sc.handlerFunc = DeleteAnnotationRegion
|
|
|
|
|
- sc.fakeReqWithParams("DELETE", sc.url, map[string]string{}).exec()
|
|
|
|
|
- So(sc.resp.Code, ShouldEqual, 200)
|
|
|
|
|
- })
|
|
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|