|
|
|
@ -47,7 +47,7 @@ func TestDashboardSnapshotDBAccess(t *testing.T) { |
|
|
|
|
|
|
|
|
|
t.Run("Should be able to get snapshot by key", func(t *testing.T) { |
|
|
|
|
query := models.GetDashboardSnapshotQuery{Key: "hej"} |
|
|
|
|
err := sqlstore.GetDashboardSnapshot(&query) |
|
|
|
|
err := sqlstore.GetDashboardSnapshot(context.Background(), &query) |
|
|
|
|
require.NoError(t, err) |
|
|
|
|
|
|
|
|
|
assert.NotNil(t, query.Result) |
|
|
|
@ -69,7 +69,7 @@ func TestDashboardSnapshotDBAccess(t *testing.T) { |
|
|
|
|
OrgId: 1, |
|
|
|
|
SignedInUser: &models.SignedInUser{OrgRole: models.ROLE_ADMIN}, |
|
|
|
|
} |
|
|
|
|
err := sqlstore.SearchDashboardSnapshots(&query) |
|
|
|
|
err := sqlstore.SearchDashboardSnapshots(context.Background(), &query) |
|
|
|
|
require.NoError(t, err) |
|
|
|
|
|
|
|
|
|
t.Run("Should return all the snapshots", func(t *testing.T) { |
|
|
|
@ -83,7 +83,7 @@ func TestDashboardSnapshotDBAccess(t *testing.T) { |
|
|
|
|
OrgId: 1, |
|
|
|
|
SignedInUser: &models.SignedInUser{OrgRole: models.ROLE_EDITOR, UserId: 1000}, |
|
|
|
|
} |
|
|
|
|
err := sqlstore.SearchDashboardSnapshots(&query) |
|
|
|
|
err := sqlstore.SearchDashboardSnapshots(context.Background(), &query) |
|
|
|
|
require.NoError(t, err) |
|
|
|
|
|
|
|
|
|
t.Run("Should return all the snapshots", func(t *testing.T) { |
|
|
|
@ -97,7 +97,7 @@ func TestDashboardSnapshotDBAccess(t *testing.T) { |
|
|
|
|
OrgId: 1, |
|
|
|
|
SignedInUser: &models.SignedInUser{OrgRole: models.ROLE_EDITOR, UserId: 2}, |
|
|
|
|
} |
|
|
|
|
err := sqlstore.SearchDashboardSnapshots(&query) |
|
|
|
|
err := sqlstore.SearchDashboardSnapshots(context.Background(), &query) |
|
|
|
|
require.NoError(t, err) |
|
|
|
|
|
|
|
|
|
t.Run("Should not return any snapshots", func(t *testing.T) { |
|
|
|
@ -124,7 +124,7 @@ func TestDashboardSnapshotDBAccess(t *testing.T) { |
|
|
|
|
OrgId: 1, |
|
|
|
|
SignedInUser: &models.SignedInUser{OrgRole: models.ROLE_EDITOR, IsAnonymous: true, UserId: 0}, |
|
|
|
|
} |
|
|
|
|
err := sqlstore.SearchDashboardSnapshots(&query) |
|
|
|
|
err := sqlstore.SearchDashboardSnapshots(context.Background(), &query) |
|
|
|
|
require.NoError(t, err) |
|
|
|
|
|
|
|
|
|
require.NotNil(t, query.Result) |
|
|
|
@ -161,7 +161,7 @@ func TestDeleteExpiredSnapshots(t *testing.T) { |
|
|
|
|
OrgId: 1, |
|
|
|
|
SignedInUser: &models.SignedInUser{OrgRole: models.ROLE_ADMIN}, |
|
|
|
|
} |
|
|
|
|
err = sqlstore.SearchDashboardSnapshots(&query) |
|
|
|
|
err = sqlstore.SearchDashboardSnapshots(context.Background(), &query) |
|
|
|
|
require.NoError(t, err) |
|
|
|
|
|
|
|
|
|
assert.Len(t, query.Result, 1) |
|
|
|
@ -174,7 +174,7 @@ func TestDeleteExpiredSnapshots(t *testing.T) { |
|
|
|
|
OrgId: 1, |
|
|
|
|
SignedInUser: &models.SignedInUser{OrgRole: models.ROLE_ADMIN}, |
|
|
|
|
} |
|
|
|
|
err = sqlstore.SearchDashboardSnapshots(&query) |
|
|
|
|
err = sqlstore.SearchDashboardSnapshots(context.Background(), &query) |
|
|
|
|
require.NoError(t, err) |
|
|
|
|
|
|
|
|
|
require.Len(t, query.Result, 1) |
|
|
|
|