grafana/pkg/services/rendering/mock.go
Artur Wierzbicki e96f67ae2e
Renderer: Add sanitize API (#50936)
* svg fun

* #50597: add proto

* #50597: add sanitizer methods

* #50597: add provider

* #50597: use sanitizer

* #50597: use sanitizer

* update grafana to match new api

* add comments

* add capability check

* add timing

* update sanitize path

* improve log message

* strings.HasPrefix rather than filepath.IsAbs

* filepath.Clean + filepath.ToSlash for windows

* read 404

* remove `path.clean` from `getPathAndScope`

* add resp body close

* remove unneeded prop

* Update pkg/services/rendering/rendering.go

Co-authored-by: Agnès Toulet <35176601+AgnesToulet@users.noreply.github.com>

* remove test files

* filepath.ToSlash correct wrapping

* filepath.ToSlash correct wrapping

* filepath.ToSlash comment

* compilation error

* lint fix

* fix error message

* Update pkg/services/rendering/rendering.go

Co-authored-by: Agnès Toulet <35176601+AgnesToulet@users.noreply.github.com>

* add `image/svg+xml` mime type

* refactored log

* refactored log

Co-authored-by: Agnès Toulet <35176601+AgnesToulet@users.noreply.github.com>
2022-07-07 15:32:18 +04:00

170 lines
6.0 KiB
Go

// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/grafana/grafana/pkg/services/rendering (interfaces: Service)
// Package rendering is a generated GoMock package.
package rendering
import (
context "context"
reflect "reflect"
gomock "github.com/golang/mock/gomock"
models "github.com/grafana/grafana/pkg/models"
)
// MockService is a mock of Service interface.
type MockService struct {
ctrl *gomock.Controller
recorder *MockServiceMockRecorder
}
// MockServiceMockRecorder is the mock recorder for MockService.
type MockServiceMockRecorder struct {
mock *MockService
}
// NewMockService creates a new mock instance.
func NewMockService(ctrl *gomock.Controller) *MockService {
mock := &MockService{ctrl: ctrl}
mock.recorder = &MockServiceMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockService) EXPECT() *MockServiceMockRecorder {
return m.recorder
}
// CreateRenderingSession mocks base method.
func (m *MockService) CreateRenderingSession(arg0 context.Context, arg1 AuthOpts, arg2 SessionOpts) (Session, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "CreateRenderingSession", arg0, arg1, arg2)
ret0, _ := ret[0].(Session)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// CreateRenderingSession indicates an expected call of CreateRenderingSession.
func (mr *MockServiceMockRecorder) CreateRenderingSession(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRenderingSession", reflect.TypeOf((*MockService)(nil).CreateRenderingSession), arg0, arg1, arg2)
}
// GetRenderUser mocks base method.
func (m *MockService) GetRenderUser(arg0 context.Context, arg1 string) (*RenderUser, bool) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetRenderUser", arg0, arg1)
ret0, _ := ret[0].(*RenderUser)
ret1, _ := ret[1].(bool)
return ret0, ret1
}
// GetRenderUser indicates an expected call of GetRenderUser.
func (mr *MockServiceMockRecorder) GetRenderUser(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRenderUser", reflect.TypeOf((*MockService)(nil).GetRenderUser), arg0, arg1)
}
// HasCapability mocks base method.
func (m *MockService) HasCapability(arg0 CapabilityName) (CapabilitySupportRequestResult, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "HasCapability", arg0)
ret0, _ := ret[0].(CapabilitySupportRequestResult)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// HasCapability indicates an expected call of HasCapability.
func (mr *MockServiceMockRecorder) HasCapability(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HasCapability", reflect.TypeOf((*MockService)(nil).HasCapability), arg0)
}
// IsAvailable mocks base method.
func (m *MockService) IsAvailable() bool {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "IsAvailable")
ret0, _ := ret[0].(bool)
return ret0
}
// IsAvailable indicates an expected call of IsAvailable.
func (mr *MockServiceMockRecorder) IsAvailable() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsAvailable", reflect.TypeOf((*MockService)(nil).IsAvailable))
}
// Render mocks base method.
func (m *MockService) Render(arg0 context.Context, arg1 Opts, arg2 Session) (*RenderResult, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Render", arg0, arg1, arg2)
ret0, _ := ret[0].(*RenderResult)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Render indicates an expected call of Render.
func (mr *MockServiceMockRecorder) Render(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Render", reflect.TypeOf((*MockService)(nil).Render), arg0, arg1, arg2)
}
// RenderCSV mocks base method.
func (m *MockService) RenderCSV(arg0 context.Context, arg1 CSVOpts, arg2 Session) (*RenderCSVResult, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "RenderCSV", arg0, arg1, arg2)
ret0, _ := ret[0].(*RenderCSVResult)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// RenderCSV indicates an expected call of RenderCSV.
func (mr *MockServiceMockRecorder) RenderCSV(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RenderCSV", reflect.TypeOf((*MockService)(nil).RenderCSV), arg0, arg1, arg2)
}
// RenderErrorImage mocks base method.
func (m *MockService) RenderErrorImage(arg0 models.Theme, arg1 error) (*RenderResult, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "RenderErrorImage", arg0, arg1)
ret0, _ := ret[0].(*RenderResult)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// RenderErrorImage indicates an expected call of RenderErrorImage.
func (mr *MockServiceMockRecorder) RenderErrorImage(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RenderErrorImage", reflect.TypeOf((*MockService)(nil).RenderErrorImage), arg0, arg1)
}
// SanitizeSVG mocks base method.
func (m *MockService) SanitizeSVG(arg0 context.Context, arg1 *SanitizeSVGRequest) (*SanitizeSVGResponse, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SanitizeSVG", arg0, arg1)
ret0, _ := ret[0].(*SanitizeSVGResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// SanitizeSVG indicates an expected call of SanitizeSVG.
func (mr *MockServiceMockRecorder) SanitizeSVG(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SanitizeSVG", reflect.TypeOf((*MockService)(nil).SanitizeSVG), arg0, arg1)
}
// Version mocks base method.
func (m *MockService) Version() string {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Version")
ret0, _ := ret[0].(string)
return ret0
}
// Version indicates an expected call of Version.
func (mr *MockServiceMockRecorder) Version() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Version", reflect.TypeOf((*MockService)(nil).Version))
}