Remove org methods from sqlstore interface (#56358)

* Remove org methods from sqlstore interface

* Remove some mocks

* Fix some tests
This commit is contained in:
idafurjes
2022-10-05 15:47:56 +02:00
committed by GitHub
parent ad2a1dd680
commit bc7a383252
11 changed files with 50 additions and 76 deletions
@@ -98,13 +98,6 @@ func (m *SQLStoreMock) GetOrgByNameHandler(ctx context.Context, query *models.Ge
return m.ExpectedError
}
func (m *SQLStoreMock) CreateOrgWithMember(name string, userID int64) (models.Org, error) {
return *m.ExpectedOrg, nil
}
func (m *SQLStoreMock) CreateOrg(ctx context.Context, cmd *models.CreateOrgCommand) error {
return m.ExpectedError
}
func (m *SQLStoreMock) UpdateOrgAddress(ctx context.Context, cmd *models.UpdateOrgAddressCommand) error {
return m.ExpectedError
}
@@ -135,19 +128,10 @@ func (m *SQLStoreMock) CreateUser(ctx context.Context, cmd user.CreateUserComman
return nil, m.ExpectedError
}
func (m *SQLStoreMock) SetUsingOrg(ctx context.Context, cmd *models.SetUsingOrgCommand) error {
return m.ExpectedSetUsingOrgError
}
func (m *SQLStoreMock) GetUserProfile(ctx context.Context, query *models.GetUserProfileQuery) error {
return m.ExpectedError
}
func (m *SQLStoreMock) GetUserOrgList(ctx context.Context, query *models.GetUserOrgListQuery) error {
query.Result = m.ExpectedUserOrgList
return m.ExpectedError
}
func (m *SQLStoreMock) GetSignedInUser(ctx context.Context, query *models.GetSignedInUserQuery) error {
query.Result = m.ExpectedSignedInUser
return m.ExpectedError
@@ -313,12 +297,6 @@ func (m *SQLStoreMock) SearchOrgUsers(ctx context.Context, query *models.SearchO
return m.ExpectedError
}
func (m *SQLStoreMock) RemoveOrgUser(ctx context.Context, cmd *models.RemoveOrgUserCommand) error {
testData := m.ExpectedOrgListResponse[0]
m.ExpectedOrgListResponse = m.ExpectedOrgListResponse[1:]
return testData.Response
}
func (m *SQLStoreMock) GetDashboardTags(ctx context.Context, query *models.GetDashboardTagsQuery) error {
return nil // TODO: Implement
}
-3
View File
@@ -19,13 +19,10 @@ type Store interface {
GetDBType() core.DbType
GetSystemStats(ctx context.Context, query *models.GetSystemStatsQuery) error
GetOrgByName(name string) (*models.Org, error)
CreateOrg(ctx context.Context, cmd *models.CreateOrgCommand) error
CreateOrgWithMember(name string, userID int64) (models.Org, error)
GetOrgById(context.Context, *models.GetOrgByIdQuery) error
GetOrgByNameHandler(ctx context.Context, query *models.GetOrgByNameQuery) error
CreateUser(ctx context.Context, cmd user.CreateUserCommand) (*user.User, error)
GetUserProfile(ctx context.Context, query *models.GetUserProfileQuery) error
GetUserOrgList(ctx context.Context, query *models.GetUserOrgListQuery) error
GetSignedInUser(ctx context.Context, query *models.GetSignedInUserQuery) error
WithDbSession(ctx context.Context, callback DBTransactionFunc) error
WithNewDbSession(ctx context.Context, callback DBTransactionFunc) error