Worked on dashboard starring and unstarring, renamed favorite model to star

This commit is contained in:
Torkel Ödegaard
2015-02-02 11:32:32 +01:00
parent 706481b1a3
commit ad3d15e28d
12 changed files with 231 additions and 118 deletions
+42
View File
@@ -0,0 +1,42 @@
package sqlstore
import (
"testing"
. "github.com/smartystreets/goconvey/convey"
m "github.com/torkelo/grafana-pro/pkg/models"
)
func TestUserStarsDataAccess(t *testing.T) {
Convey("Testing User Stars Data Access", t, func() {
InitTestDB(t)
Convey("Given saved star", func() {
cmd := m.StarDashboardCommand{
DashboardId: 10,
UserId: 12,
}
err := StarDashboard(&cmd)
So(err, ShouldBeNil)
Convey("IsStarredByUser should return true when starred", func() {
query := m.IsStarredByUserQuery{UserId: 12, DashboardId: 10}
err := IsStarredByUser(&query)
So(err, ShouldBeNil)
So(query.Result, ShouldBeTrue)
})
Convey("IsStarredByUser should return false when not starred", func() {
query := m.IsStarredByUserQuery{UserId: 12, DashboardId: 12}
err := IsStarredByUser(&query)
So(err, ShouldBeNil)
So(query.Result, ShouldBeFalse)
})
})
})
}