2014-08-22 08:32:42 -05:00
|
|
|
package models
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
. "github.com/smartystreets/goconvey/convey"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestDashboardModel(t *testing.T) {
|
|
|
|
|
|
|
|
Convey("When generating slug", t, func() {
|
|
|
|
dashboard := NewDashboard("Grafana Play Home")
|
|
|
|
dashboard.UpdateSlug()
|
|
|
|
|
|
|
|
So(dashboard.Slug, ShouldEqual, "grafana-play-home")
|
|
|
|
})
|
|
|
|
|
2015-06-12 02:04:10 -05:00
|
|
|
Convey("Given a dashboard json", t, func() {
|
|
|
|
json := map[string]interface{}{
|
|
|
|
"title": "test dash",
|
|
|
|
}
|
|
|
|
|
|
|
|
Convey("With tags as string value", func() {
|
|
|
|
json["tags"] = ""
|
|
|
|
dash := NewDashboardFromJson(json)
|
|
|
|
|
|
|
|
So(len(dash.GetTags()), ShouldEqual, 0)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2014-08-22 08:32:42 -05:00
|
|
|
}
|