forked from nytm/go-grafana-api
-
Notifications
You must be signed in to change notification settings - Fork 1
/
dashboard_test.go
49 lines (41 loc) · 1.11 KB
/
dashboard_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package gapi
import (
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestDashboardTags(t *testing.T) {
Convey("given a dashboard", t, func() {
d := NewDashboard()
Convey("should be able to add some tags", func() {
d.AddTags("home", "ok")
So(d.Tags(), ShouldContain, "home")
So(d.Tags(), ShouldContain, "ok")
})
Convey("should be able to set all tags", func() {
d.AddTags("home", "ok")
d.SetTags("set", "this")
So(d.Tags(), ShouldNotContain, "home")
So(d.Tags(), ShouldNotContain, "ok")
So(d.Tags(), ShouldContain, "this")
So(d.Tags(), ShouldContain, "set")
})
Convey("should be able to remove a tags", func() {
d.AddTags("home", "ok", "horse")
d.RemoveTags("home", "ok")
So(d.Tags(), ShouldNotContain, "home")
So(d.Tags(), ShouldNotContain, "ok")
So(d.Tags(), ShouldContain, "horse")
})
})
}
func TestDashboardTitle(t *testing.T) {
Convey("given a dashboard", t, func() {
d := NewDashboard()
d.Model["title"] = "hihi"
Convey("it should give the title", func() {
t, ok := d.Title()
So(ok, ShouldBeTrue)
So(t, ShouldEqual, "hihi")
})
})
}