mirror of
https://github.com/grafana/grafana.git
synced 2024-11-30 12:44:10 -06:00
43 lines
916 B
Go
43 lines
916 B
Go
package sqlstore
|
|
|
|
import (
|
|
"testing"
|
|
|
|
m "github.com/grafana/grafana/pkg/models"
|
|
. "github.com/smartystreets/goconvey/convey"
|
|
)
|
|
|
|
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)
|
|
})
|
|
|
|
})
|
|
})
|
|
}
|