|
|
@@ -4,11 +4,24 @@ import (
|
|
|
"testing"
|
|
|
|
|
|
"github.com/grafana/grafana/pkg/components/simplejson"
|
|
|
+ "github.com/grafana/grafana/pkg/setting"
|
|
|
. "github.com/smartystreets/goconvey/convey"
|
|
|
)
|
|
|
|
|
|
func TestDashboardModel(t *testing.T) {
|
|
|
|
|
|
+ Convey("Generate full dashboard url", t, func() {
|
|
|
+ setting.AppUrl = "http://grafana.local/"
|
|
|
+ fullUrl := GetFullDashboardUrl("uid", "my-dashboard")
|
|
|
+ So(fullUrl, ShouldEqual, "http://grafana.local/d/uid/my-dashboard")
|
|
|
+ })
|
|
|
+
|
|
|
+ Convey("Generate relative dashboard url", t, func() {
|
|
|
+ setting.AppUrl = ""
|
|
|
+ fullUrl := GetDashboardUrl("uid", "my-dashboard")
|
|
|
+ So(fullUrl, ShouldEqual, "/d/uid/my-dashboard")
|
|
|
+ })
|
|
|
+
|
|
|
Convey("When generating slug", t, func() {
|
|
|
dashboard := NewDashboard("Grafana Play Home")
|
|
|
dashboard.UpdateSlug()
|