mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Remove mockstore and use dbtest instead (#61629)
* remove mockstore and use dbtest instead * fix wire * remove unused expected fields * fix more tests in alerting * fix api tests
This commit is contained in:
@@ -12,12 +12,12 @@ import (
|
||||
"github.com/grafana/grafana/pkg/api/routing"
|
||||
"github.com/grafana/grafana/pkg/components/simplejson"
|
||||
"github.com/grafana/grafana/pkg/infra/db"
|
||||
"github.com/grafana/grafana/pkg/infra/db/dbtest"
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/services/auth"
|
||||
"github.com/grafana/grafana/pkg/services/auth/authtest"
|
||||
"github.com/grafana/grafana/pkg/services/login/logintest"
|
||||
"github.com/grafana/grafana/pkg/services/org"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore/mockstore"
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
"github.com/grafana/grafana/pkg/services/user/usertest"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
@@ -148,7 +148,6 @@ func TestAdminAPIEndpoint(t *testing.T) {
|
||||
t.Run("When a server admin attempts to delete a nonexistent user", func(t *testing.T) {
|
||||
adminDeleteUserScenario(t, "Should return user not found error", "/api/admin/users/42",
|
||||
"/api/admin/users/:id", func(sc *scenarioContext) {
|
||||
sc.sqlStore.(*mockstore.SQLStoreMock).ExpectedError = user.ErrUserNotFound
|
||||
sc.userService.(*usertest.FakeUserService).ExpectedError = user.ErrUserNotFound
|
||||
sc.authInfoService.ExpectedError = user.ErrUserNotFound
|
||||
sc.fakeReqWithParams("DELETE", sc.url, map[string]string{}).exec()
|
||||
@@ -346,7 +345,7 @@ func adminDisableUserScenario(t *testing.T, desc string, action string, url stri
|
||||
authInfoService := &logintest.AuthInfoServiceFake{}
|
||||
|
||||
hs := HTTPServer{
|
||||
SQLStore: mockstore.NewSQLStoreMock(),
|
||||
SQLStore: dbtest.NewFakeDB(),
|
||||
AuthTokenService: fakeAuthTokenService,
|
||||
authInfoService: authInfoService,
|
||||
userService: usertest.NewUserServiceFake(),
|
||||
@@ -375,7 +374,7 @@ func adminDisableUserScenario(t *testing.T, desc string, action string, url stri
|
||||
|
||||
func adminDeleteUserScenario(t *testing.T, desc string, url string, routePattern string, fn scenarioFunc) {
|
||||
hs := HTTPServer{
|
||||
SQLStore: mockstore.NewSQLStoreMock(),
|
||||
SQLStore: dbtest.NewFakeDB(),
|
||||
userService: usertest.NewUserServiceFake(),
|
||||
}
|
||||
t.Run(fmt.Sprintf("%s %s", desc, url), func(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user