mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Return data in camelCase from the OAuth fb strategy * changes * wip * Add defaults for oauth fb strategy * revert other changes * basic includeDefaults query param implementation * basic secret removal and etag implementation * correct imports * rebase * move default settings filter to models * only replace ClientSecret value if set * first GetForProvider test & use FNV for ETag to avoid Blocklisted import error * add tests * add annotation for the openapi spec & generate spec * remove TODO * use IsSecret, improve tests, remove DefaultOAuthSettings * add comment explaining generateFNVETag * add error handling for generateFNVETag * run go generate * Update pkg/services/ssosettings/api/api.go Co-authored-by: Mihai Doarna <mihai.doarna@grafana.com> * move isSecret to service, create GetForProviderWithRedactedSecrets func * add unit test for GetForProviderWithRedactedSecrets & remove duplicated code * regen openapi/swagger * revert dependency bumps --------- Co-authored-by: Mihaly Gyongyosi <mgyongyosi@users.noreply.github.com> Co-authored-by: Mihai Doarna <mihai.doarna@grafana.com>
186 lines
4.7 KiB
Go
186 lines
4.7 KiB
Go
// Code generated by mockery v2.38.0. DO NOT EDIT.
|
|
|
|
package ssosettingstests
|
|
|
|
import (
|
|
context "context"
|
|
|
|
models "github.com/grafana/grafana/pkg/services/ssosettings/models"
|
|
mock "github.com/stretchr/testify/mock"
|
|
|
|
ssosettings "github.com/grafana/grafana/pkg/services/ssosettings"
|
|
)
|
|
|
|
// MockService is an autogenerated mock type for the Service type
|
|
type MockService struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// Delete provides a mock function with given fields: ctx, provider
|
|
func (_m *MockService) Delete(ctx context.Context, provider string) error {
|
|
ret := _m.Called(ctx, provider)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Delete")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) error); ok {
|
|
r0 = rf(ctx, provider)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// GetForProvider provides a mock function with given fields: ctx, provider
|
|
func (_m *MockService) GetForProvider(ctx context.Context, provider string) (*models.SSOSettings, error) {
|
|
ret := _m.Called(ctx, provider)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetForProvider")
|
|
}
|
|
|
|
var r0 *models.SSOSettings
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) (*models.SSOSettings, error)); ok {
|
|
return rf(ctx, provider)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) *models.SSOSettings); ok {
|
|
r0 = rf(ctx, provider)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*models.SSOSettings)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
|
|
r1 = rf(ctx, provider)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetForProviderWithRedactedSecrets provides a mock function with given fields: ctx, provider
|
|
func (_m *MockService) GetForProviderWithRedactedSecrets(ctx context.Context, provider string) (*models.SSOSettings, error) {
|
|
ret := _m.Called(ctx, provider)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetForProviderWithRedactedSecrets")
|
|
}
|
|
|
|
var r0 *models.SSOSettings
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) (*models.SSOSettings, error)); ok {
|
|
return rf(ctx, provider)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) *models.SSOSettings); ok {
|
|
r0 = rf(ctx, provider)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*models.SSOSettings)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
|
|
r1 = rf(ctx, provider)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// List provides a mock function with given fields: ctx
|
|
func (_m *MockService) List(ctx context.Context) ([]*models.SSOSettings, error) {
|
|
ret := _m.Called(ctx)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for List")
|
|
}
|
|
|
|
var r0 []*models.SSOSettings
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context) ([]*models.SSOSettings, error)); ok {
|
|
return rf(ctx)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context) []*models.SSOSettings); ok {
|
|
r0 = rf(ctx)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*models.SSOSettings)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
|
|
r1 = rf(ctx)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Patch provides a mock function with given fields: ctx, provider, data
|
|
func (_m *MockService) Patch(ctx context.Context, provider string, data map[string]interface{}) error {
|
|
ret := _m.Called(ctx, provider, data)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Patch")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, map[string]interface{}) error); ok {
|
|
r0 = rf(ctx, provider, data)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// RegisterReloadable provides a mock function with given fields: provider, reloadable
|
|
func (_m *MockService) RegisterReloadable(provider string, reloadable ssosettings.Reloadable) {
|
|
_m.Called(provider, reloadable)
|
|
}
|
|
|
|
// Reload provides a mock function with given fields: ctx, provider
|
|
func (_m *MockService) Reload(ctx context.Context, provider string) {
|
|
_m.Called(ctx, provider)
|
|
}
|
|
|
|
// Upsert provides a mock function with given fields: ctx, settings
|
|
func (_m *MockService) Upsert(ctx context.Context, settings models.SSOSettings) error {
|
|
ret := _m.Called(ctx, settings)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Upsert")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, models.SSOSettings) error); ok {
|
|
r0 = rf(ctx, settings)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// NewMockService creates a new instance of MockService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
|
// The first argument is typically a *testing.T value.
|
|
func NewMockService(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *MockService {
|
|
mock := &MockService{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|