Chore: use org service methods (#55768)

* Chore: use org service methods

* fix tests

* fix errors

* adjust func signatures for getbyname

* 💩

* Use the same fake service to get the user in AC and in HS

* Fix middleware test

* Fix more middleware test

* Fix api tests

Co-authored-by: gamab <gabi.mabs@gmail.com>
Co-authored-by: Ida Furjesova <ida.furjesova@grafana.com>
This commit is contained in:
Kat Yang
2022-10-04 14:48:02 -04:00
committed by GitHub
co-authored by gamab Ida Furjesova
parent 169f1ab974
commit 7715672fb3
14 changed files with 108 additions and 67 deletions
@@ -5,6 +5,8 @@ import (
"errors"
"testing"
"github.com/grafana/grafana/pkg/services/org"
"github.com/grafana/grafana/pkg/services/org/orgtest"
"github.com/grafana/grafana/pkg/services/pluginsettings"
"github.com/grafana/grafana/pkg/infra/log"
@@ -34,7 +36,9 @@ func TestPluginProvisioner(t *testing.T) {
}
reader := &testConfigReader{result: cfg}
store := &mockStore{}
ap := PluginProvisioner{log: log.New("test"), cfgProvider: reader, store: store, pluginSettings: store}
orgMock := orgtest.NewOrgServiceFake()
orgMock.ExpectedOrg = &org.Org{ID: 4}
ap := PluginProvisioner{log: log.New("test"), cfgProvider: reader, pluginSettings: store, orgService: orgMock}
err := ap.applyChanges(context.Background(), "")
require.NoError(t, err)