Stars: Remove deprecated internal ID apis (#110499)
This commit is contained in:
@@ -27,46 +27,6 @@ func testIntegrationUserStarsDataAccess(t *testing.T, fn getStore) {
|
||||
ss := db.InitTestDB(t)
|
||||
starStore := fn(ss)
|
||||
|
||||
t.Run("Given saved star by dashboard id", func(t *testing.T) {
|
||||
cmd := star.StarDashboardCommand{
|
||||
DashboardID: 10,
|
||||
UserID: 12,
|
||||
}
|
||||
err := starStore.Insert(context.Background(), &cmd)
|
||||
require.NoError(t, err)
|
||||
|
||||
t.Run("Get should return true when starred", func(t *testing.T) {
|
||||
query := star.IsStarredByUserQuery{UserID: 12, DashboardID: 10}
|
||||
isStarred, err := starStore.Get(context.Background(), &query)
|
||||
require.NoError(t, err)
|
||||
require.True(t, isStarred)
|
||||
})
|
||||
|
||||
t.Run("Get should return false when not starred", func(t *testing.T) {
|
||||
query := star.IsStarredByUserQuery{UserID: 12, DashboardID: 12}
|
||||
isStarred, err := starStore.Get(context.Background(), &query)
|
||||
require.NoError(t, err)
|
||||
require.False(t, isStarred)
|
||||
})
|
||||
|
||||
t.Run("List should return a list of size 1", func(t *testing.T) {
|
||||
query := star.GetUserStarsQuery{UserID: 12}
|
||||
result, err := starStore.List(context.Background(), &query)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 1, len(result.UserStars))
|
||||
})
|
||||
|
||||
t.Run("Delete should remove the star", func(t *testing.T) {
|
||||
deleteQuery := star.UnstarDashboardCommand{DashboardID: 10, UserID: 12}
|
||||
err := starStore.Delete(context.Background(), &deleteQuery)
|
||||
require.NoError(t, err)
|
||||
getQuery := star.IsStarredByUserQuery{UserID: 12, DashboardID: 10}
|
||||
isStarred, err := starStore.Get(context.Background(), &getQuery)
|
||||
require.NoError(t, err)
|
||||
require.False(t, isStarred)
|
||||
})
|
||||
})
|
||||
|
||||
t.Run("Given saved star by dashboard UID", func(t *testing.T) {
|
||||
cmd := star.StarDashboardCommand{
|
||||
DashboardUID: "test",
|
||||
@@ -113,7 +73,6 @@ func testIntegrationUserStarsDataAccess(t *testing.T, fn getStore) {
|
||||
DashboardUID: "test",
|
||||
OrgID: 1,
|
||||
Updated: time.Now(),
|
||||
DashboardID: 10,
|
||||
UserID: 12,
|
||||
}
|
||||
err := starStore.Insert(context.Background(), &star1)
|
||||
@@ -122,7 +81,6 @@ func testIntegrationUserStarsDataAccess(t *testing.T, fn getStore) {
|
||||
DashboardUID: "test2",
|
||||
OrgID: 1,
|
||||
Updated: time.Now(),
|
||||
DashboardID: 11,
|
||||
UserID: 12,
|
||||
}
|
||||
err = starStore.Insert(context.Background(), &star2)
|
||||
@@ -131,7 +89,6 @@ func testIntegrationUserStarsDataAccess(t *testing.T, fn getStore) {
|
||||
DashboardUID: "test2",
|
||||
OrgID: 1,
|
||||
Updated: time.Now(),
|
||||
DashboardID: 11,
|
||||
UserID: 11,
|
||||
}
|
||||
err = starStore.Insert(context.Background(), &star3)
|
||||
|
||||
Reference in New Issue
Block a user