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:
Karl Persson
2023-11-21 14:47:23 +01:00
committed by GitHub
parent d85f03ec26
commit 1eb19befaa
22 changed files with 116 additions and 402 deletions

View File

@@ -20,7 +20,7 @@ import (
"github.com/grafana/grafana/pkg/services/auth/authtest"
contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model"
"github.com/grafana/grafana/pkg/services/login"
"github.com/grafana/grafana/pkg/services/login/logintest"
"github.com/grafana/grafana/pkg/services/login/authinfotest"
"github.com/grafana/grafana/pkg/services/org"
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/services/user/usertest"
@@ -312,7 +312,7 @@ func Test_AdminUpdateUserPermissions(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{}
cfg := setting.NewCfg()
@@ -357,7 +357,7 @@ func putAdminScenario(t *testing.T, desc string, url string, routePattern string
hs := &HTTPServer{
Cfg: setting.NewCfg(),
SQLStore: sqlStore,
authInfoService: &logintest.AuthInfoServiceFake{},
authInfoService: &authinfotest.FakeService{},
userService: userSvc,
}
@@ -462,7 +462,7 @@ func adminDisableUserScenario(t *testing.T, desc string, action string, url stri
t.Run(fmt.Sprintf("%s %s", desc, url), func(t *testing.T) {
fakeAuthTokenService := authtest.NewFakeUserAuthTokenService()
authInfoService := &logintest.AuthInfoServiceFake{}
authInfoService := &authinfotest.FakeService{}
hs := HTTPServer{
SQLStore: dbtest.NewFakeDB(),
@@ -500,7 +500,7 @@ func adminDeleteUserScenario(t *testing.T, desc string, url string, routePattern
t.Run(fmt.Sprintf("%s %s", desc, url), func(t *testing.T) {
sc := setupScenarioContext(t, url)
sc.sqlStore = hs.SQLStore
sc.authInfoService = &logintest.AuthInfoServiceFake{}
sc.authInfoService = &authinfotest.FakeService{}
sc.defaultHandler = routing.Wrap(func(c *contextmodel.ReqContext) response.Response {
sc.context = c
sc.context.UserID = testUserID