diff options
author | Tuomo Ala-Vannesluoma <tuomoav@gmail.com> | 2019-09-26 16:35:28 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-09-26 16:35:28 +0300 |
commit | c781a7ccd3147f750faeda631db15d06de455949 (patch) | |
tree | c2d190d278bb270eed5b2ecae0ba9e77f84e1577 /internal/mocks/mocks.go | |
parent | 218376d484a8ec55882b037475ec3201d1c897cf (diff) |
Add support for previewing artifacts that are not public
Remove some duplicate logic on Auth module
Separate handling artifact to own handlers package
Unit test handlers by mocking auth and artifact modules
Add generate-mock step to Makefile
Use additional handler func to simplify TryMakeRequest return type
Always try with token if exists
Do not log RequestURI, log path only
Remove not used logRequest func
Diffstat (limited to 'internal/mocks/mocks.go')
-rw-r--r-- | internal/mocks/mocks.go | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/internal/mocks/mocks.go b/internal/mocks/mocks.go new file mode 100644 index 00000000..2816205d --- /dev/null +++ b/internal/mocks/mocks.go @@ -0,0 +1,128 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: internal/interface.go + +// Package mocks is a generated GoMock package. +package mocks + +import ( + gomock "github.com/golang/mock/gomock" + http "net/http" + reflect "reflect" +) + +// MockArtifact is a mock of Artifact interface +type MockArtifact struct { + ctrl *gomock.Controller + recorder *MockArtifactMockRecorder +} + +// MockArtifactMockRecorder is the mock recorder for MockArtifact +type MockArtifactMockRecorder struct { + mock *MockArtifact +} + +// NewMockArtifact creates a new mock instance +func NewMockArtifact(ctrl *gomock.Controller) *MockArtifact { + mock := &MockArtifact{ctrl: ctrl} + mock.recorder = &MockArtifactMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockArtifact) EXPECT() *MockArtifactMockRecorder { + return m.recorder +} + +// TryMakeRequest mocks base method +func (m *MockArtifact) TryMakeRequest(host string, w http.ResponseWriter, r *http.Request, token string, responseHandler func(*http.Response) bool) bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TryMakeRequest", host, w, r, token, responseHandler) + ret0, _ := ret[0].(bool) + return ret0 +} + +// TryMakeRequest indicates an expected call of TryMakeRequest +func (mr *MockArtifactMockRecorder) TryMakeRequest(host, w, r, token, responseHandler interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TryMakeRequest", reflect.TypeOf((*MockArtifact)(nil).TryMakeRequest), host, w, r, token, responseHandler) +} + +// MockAuth is a mock of Auth interface +type MockAuth struct { + ctrl *gomock.Controller + recorder *MockAuthMockRecorder +} + +// MockAuthMockRecorder is the mock recorder for MockAuth +type MockAuthMockRecorder struct { + mock *MockAuth +} + +// NewMockAuth creates a new mock instance +func NewMockAuth(ctrl *gomock.Controller) *MockAuth { + mock := &MockAuth{ctrl: ctrl} + mock.recorder = &MockAuthMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockAuth) EXPECT() *MockAuthMockRecorder { + return m.recorder +} + +// IsAuthSupported mocks base method +func (m *MockAuth) IsAuthSupported() bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "IsAuthSupported") + ret0, _ := ret[0].(bool) + return ret0 +} + +// IsAuthSupported indicates an expected call of IsAuthSupported +func (mr *MockAuthMockRecorder) IsAuthSupported() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsAuthSupported", reflect.TypeOf((*MockAuth)(nil).IsAuthSupported)) +} + +// RequireAuth mocks base method +func (m *MockAuth) RequireAuth(w http.ResponseWriter, r *http.Request) bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RequireAuth", w, r) + ret0, _ := ret[0].(bool) + return ret0 +} + +// RequireAuth indicates an expected call of RequireAuth +func (mr *MockAuthMockRecorder) RequireAuth(w, r interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RequireAuth", reflect.TypeOf((*MockAuth)(nil).RequireAuth), w, r) +} + +// GetTokenIfExists mocks base method +func (m *MockAuth) GetTokenIfExists(w http.ResponseWriter, r *http.Request) (string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTokenIfExists", w, r) + ret0, _ := ret[0].(string) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetTokenIfExists indicates an expected call of GetTokenIfExists +func (mr *MockAuthMockRecorder) GetTokenIfExists(w, r interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTokenIfExists", reflect.TypeOf((*MockAuth)(nil).GetTokenIfExists), w, r) +} + +// CheckResponseForInvalidToken mocks base method +func (m *MockAuth) CheckResponseForInvalidToken(w http.ResponseWriter, r *http.Request, resp *http.Response) bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CheckResponseForInvalidToken", w, r, resp) + ret0, _ := ret[0].(bool) + return ret0 +} + +// CheckResponseForInvalidToken indicates an expected call of CheckResponseForInvalidToken +func (mr *MockAuthMockRecorder) CheckResponseForInvalidToken(w, r, resp interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckResponseForInvalidToken", reflect.TypeOf((*MockAuth)(nil).CheckResponseForInvalidToken), w, r, resp) +} |