Login: refactor auth info package (#78459)
* Remove unused stats and metrics * No longer collect metrics * Remove unused dependency * Move database from sub package
This commit is contained in:
@@ -24,9 +24,8 @@ import (
|
||||
acmock "github.com/grafana/grafana/pkg/services/accesscontrol/mock"
|
||||
contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model"
|
||||
"github.com/grafana/grafana/pkg/services/login"
|
||||
"github.com/grafana/grafana/pkg/services/login/authinfoservice"
|
||||
authinfostore "github.com/grafana/grafana/pkg/services/login/authinfoservice/database"
|
||||
"github.com/grafana/grafana/pkg/services/login/logintest"
|
||||
"github.com/grafana/grafana/pkg/services/login/authinfoimpl"
|
||||
"github.com/grafana/grafana/pkg/services/login/authinfotest"
|
||||
"github.com/grafana/grafana/pkg/services/org/orgimpl"
|
||||
"github.com/grafana/grafana/pkg/services/quota/quotatest"
|
||||
"github.com/grafana/grafana/pkg/services/searchusers"
|
||||
@@ -63,8 +62,8 @@ func TestUserAPIEndpoint_userLoggedIn(t *testing.T) {
|
||||
loggedInUserScenario(t, "When calling GET on", "api/users/1", "api/users/:id", func(sc *scenarioContext) {
|
||||
fakeNow := time.Date(2019, 2, 11, 17, 30, 40, 0, time.UTC)
|
||||
secretsService := secretsManager.SetupTestService(t, database.ProvideSecretsStore(sqlStore))
|
||||
authInfoStore := authinfostore.ProvideAuthInfoStore(sqlStore, secretsService, userMock)
|
||||
srv := authinfoservice.ProvideAuthInfoService(
|
||||
authInfoStore := authinfoimpl.ProvideStore(sqlStore, secretsService)
|
||||
srv := authinfoimpl.ProvideService(
|
||||
authInfoStore,
|
||||
)
|
||||
hs.authInfoService = srv
|
||||
@@ -292,7 +291,7 @@ func Test_GetUserByID(t *testing.T) {
|
||||
for _, tc := range testcases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
userAuth := &login.UserAuth{AuthModule: tc.authModule}
|
||||
authInfoService := &logintest.AuthInfoServiceFake{ExpectedUserAuth: userAuth}
|
||||
authInfoService := &authinfotest.FakeService{ExpectedUserAuth: userAuth}
|
||||
socialService := &socialtest.FakeSocialService{}
|
||||
userService := &usertest.FakeUserService{ExpectedUserProfileDTO: &user.UserProfileDTO{}}
|
||||
cfg := setting.NewCfg()
|
||||
@@ -376,7 +375,7 @@ func updateUserScenario(t *testing.T, ctx updateUserContext, hs *HTTPServer) {
|
||||
t.Run(fmt.Sprintf("%s %s", ctx.desc, ctx.url), func(t *testing.T) {
|
||||
sc := setupScenarioContext(t, ctx.url)
|
||||
|
||||
sc.authInfoService = &logintest.AuthInfoServiceFake{}
|
||||
sc.authInfoService = &authinfotest.FakeService{}
|
||||
hs.authInfoService = sc.authInfoService
|
||||
|
||||
sc.defaultHandler = routing.Wrap(func(c *contextmodel.ReqContext) response.Response {
|
||||
@@ -429,7 +428,7 @@ func updateSignedInUserScenario(t *testing.T, ctx updateUserContext, hs *HTTPSer
|
||||
t.Run(fmt.Sprintf("%s %s", ctx.desc, ctx.url), func(t *testing.T) {
|
||||
sc := setupScenarioContext(t, ctx.url)
|
||||
|
||||
sc.authInfoService = &logintest.AuthInfoServiceFake{}
|
||||
sc.authInfoService = &authinfotest.FakeService{}
|
||||
hs.authInfoService = sc.authInfoService
|
||||
|
||||
sc.defaultHandler = routing.Wrap(func(c *contextmodel.ReqContext) response.Response {
|
||||
|
||||
Reference in New Issue
Block a user