Chore: Add methods from sqlstore to org service interface (#55635)

* Chore: Copy methods from sqlstore to org store

* Rename method, add test

* Add comments of tests

* Chore: Add methods from sqlstore to org service interface

* Avoiding import cycle

* Add and remove some methods
This commit is contained in:
idafurjes
2022-09-23 09:58:17 +02:00
committed by GitHub
parent c9b5acfefc
commit e8a60c1988
4 changed files with 95 additions and 0 deletions
+18
View File
@@ -3,6 +3,7 @@ package orgtest
import (
"context"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/services/org"
)
@@ -12,6 +13,7 @@ type FakeOrgService struct {
ExpectedUserOrgDTO []*org.UserOrgDTO
ExpectedOrgs []*org.OrgDTO
ExpectedOrg *org.Org
ExpectedOrgUsers []*org.OrgUserDTO
}
func NewOrgServiceFake() *FakeOrgService {
@@ -73,3 +75,19 @@ func (f *FakeOrgService) Delete(ctx context.Context, cmd *org.DeleteOrgCommand)
func (f *FakeOrgService) GetOrCreate(ctx context.Context, orgName string) (int64, error) {
return 0, f.ExpectedError
}
func (f *FakeOrgService) AddOrgUser(ctx context.Context, cmd *org.AddOrgUserCommand) error {
return f.ExpectedError
}
func (f *FakeOrgService) UpdateOrgUser(ctx context.Context, cmd *org.UpdateOrgUserCommand) error {
return f.ExpectedError
}
func (f *FakeOrgService) GetOrgUsers(ctx context.Context, query *models.GetOrgUsersQuery) ([]*org.OrgUserDTO, error) {
return f.ExpectedOrgUsers, f.ExpectedError
}
func (f *FakeOrgService) RemoveOrgUser(ctx context.Context, cmd *org.RemoveOrgUserCommand) error {
return f.ExpectedError
}