added mocks for piwigo context

This commit is contained in:
Philipp Häfelfinger 2019-03-21 22:37:08 +01:00
parent 061bb112d5
commit ce64892222
2 changed files with 214 additions and 0 deletions

View File

@ -0,0 +1,212 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: git.haefelfinger.net/piwigo/PiwigoDirectoryUploader/internal/pkg/piwigo (interfaces: PiwigoApi,PiwigoCategoryApi,PiwigoImageApi)
// Package mocks is a generated GoMock package.
package mocks
import (
piwigo "git.haefelfinger.net/piwigo/PiwigoDirectoryUploader/internal/pkg/piwigo"
gomock "github.com/golang/mock/gomock"
reflect "reflect"
)
// MockPiwigoApi is a mock of PiwigoApi interface
type MockPiwigoApi struct {
ctrl *gomock.Controller
recorder *MockPiwigoApiMockRecorder
}
// MockPiwigoApiMockRecorder is the mock recorder for MockPiwigoApi
type MockPiwigoApiMockRecorder struct {
mock *MockPiwigoApi
}
// NewMockPiwigoApi creates a new mock instance
func NewMockPiwigoApi(ctrl *gomock.Controller) *MockPiwigoApi {
mock := &MockPiwigoApi{ctrl: ctrl}
mock.recorder = &MockPiwigoApiMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockPiwigoApi) EXPECT() *MockPiwigoApiMockRecorder {
return m.recorder
}
// GetStatus mocks base method
func (m *MockPiwigoApi) GetStatus() (*piwigo.getStatusResponse, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetStatus")
ret0, _ := ret[0].(*piwigo.getStatusResponse)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// GetStatus indicates an expected call of GetStatus
func (mr *MockPiwigoApiMockRecorder) GetStatus() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetStatus", reflect.TypeOf((*MockPiwigoApi)(nil).GetStatus))
}
// Initialize mocks base method
func (m *MockPiwigoApi) Initialize(arg0, arg1, arg2 string, arg3 int) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Initialize", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(error)
return ret0
}
// Initialize indicates an expected call of Initialize
func (mr *MockPiwigoApiMockRecorder) Initialize(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Initialize", reflect.TypeOf((*MockPiwigoApi)(nil).Initialize), arg0, arg1, arg2, arg3)
}
// Login mocks base method
func (m *MockPiwigoApi) Login() error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Login")
ret0, _ := ret[0].(error)
return ret0
}
// Login indicates an expected call of Login
func (mr *MockPiwigoApiMockRecorder) Login() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Login", reflect.TypeOf((*MockPiwigoApi)(nil).Login))
}
// Logout mocks base method
func (m *MockPiwigoApi) Logout() error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Logout")
ret0, _ := ret[0].(error)
return ret0
}
// Logout indicates an expected call of Logout
func (mr *MockPiwigoApiMockRecorder) Logout() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Logout", reflect.TypeOf((*MockPiwigoApi)(nil).Logout))
}
// MockPiwigoCategoryApi is a mock of PiwigoCategoryApi interface
type MockPiwigoCategoryApi struct {
ctrl *gomock.Controller
recorder *MockPiwigoCategoryApiMockRecorder
}
// MockPiwigoCategoryApiMockRecorder is the mock recorder for MockPiwigoCategoryApi
type MockPiwigoCategoryApiMockRecorder struct {
mock *MockPiwigoCategoryApi
}
// NewMockPiwigoCategoryApi creates a new mock instance
func NewMockPiwigoCategoryApi(ctrl *gomock.Controller) *MockPiwigoCategoryApi {
mock := &MockPiwigoCategoryApi{ctrl: ctrl}
mock.recorder = &MockPiwigoCategoryApiMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockPiwigoCategoryApi) EXPECT() *MockPiwigoCategoryApiMockRecorder {
return m.recorder
}
// CreateCategory mocks base method
func (m *MockPiwigoCategoryApi) CreateCategory(arg0 int, arg1 string) (int, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "CreateCategory", arg0, arg1)
ret0, _ := ret[0].(int)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// CreateCategory indicates an expected call of CreateCategory
func (mr *MockPiwigoCategoryApiMockRecorder) CreateCategory(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateCategory", reflect.TypeOf((*MockPiwigoCategoryApi)(nil).CreateCategory), arg0, arg1)
}
// GetAllCategories mocks base method
func (m *MockPiwigoCategoryApi) GetAllCategories() (map[string]*piwigo.PiwigoCategory, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetAllCategories")
ret0, _ := ret[0].(map[string]*piwigo.PiwigoCategory)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// GetAllCategories indicates an expected call of GetAllCategories
func (mr *MockPiwigoCategoryApiMockRecorder) GetAllCategories() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllCategories", reflect.TypeOf((*MockPiwigoCategoryApi)(nil).GetAllCategories))
}
// MockPiwigoImageApi is a mock of PiwigoImageApi interface
type MockPiwigoImageApi struct {
ctrl *gomock.Controller
recorder *MockPiwigoImageApiMockRecorder
}
// MockPiwigoImageApiMockRecorder is the mock recorder for MockPiwigoImageApi
type MockPiwigoImageApiMockRecorder struct {
mock *MockPiwigoImageApi
}
// NewMockPiwigoImageApi creates a new mock instance
func NewMockPiwigoImageApi(ctrl *gomock.Controller) *MockPiwigoImageApi {
mock := &MockPiwigoImageApi{ctrl: ctrl}
mock.recorder = &MockPiwigoImageApiMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockPiwigoImageApi) EXPECT() *MockPiwigoImageApiMockRecorder {
return m.recorder
}
// ImageCheckFile mocks base method
func (m *MockPiwigoImageApi) ImageCheckFile(arg0 int, arg1 string) (int, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ImageCheckFile", arg0, arg1)
ret0, _ := ret[0].(int)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// ImageCheckFile indicates an expected call of ImageCheckFile
func (mr *MockPiwigoImageApiMockRecorder) ImageCheckFile(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImageCheckFile", reflect.TypeOf((*MockPiwigoImageApi)(nil).ImageCheckFile), arg0, arg1)
}
// ImagesExistOnPiwigo mocks base method
func (m *MockPiwigoImageApi) ImagesExistOnPiwigo(arg0 []string) (map[string]int, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ImagesExistOnPiwigo", arg0)
ret0, _ := ret[0].(map[string]int)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// ImagesExistOnPiwigo indicates an expected call of ImagesExistOnPiwigo
func (mr *MockPiwigoImageApiMockRecorder) ImagesExistOnPiwigo(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ImagesExistOnPiwigo", reflect.TypeOf((*MockPiwigoImageApi)(nil).ImagesExistOnPiwigo), arg0)
}
// UploadImage mocks base method
func (m *MockPiwigoImageApi) UploadImage(arg0 int, arg1, arg2 string, arg3 int) (int, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "UploadImage", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(int)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// UploadImage indicates an expected call of UploadImage
func (mr *MockPiwigoImageApiMockRecorder) UploadImage(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UploadImage", reflect.TypeOf((*MockPiwigoImageApi)(nil).UploadImage), arg0, arg1, arg2, arg3)
}

View File

@ -1,5 +1,7 @@
package piwigo
//go:generate mockgen -destination=../mocks/mock_piwigo_context.go -package=mocks git.haefelfinger.net/piwigo/PiwigoDirectoryUploader/internal/pkg/piwigo PiwigoApi,PiwigoCategoryApi,PiwigoImageApi
import (
"encoding/json"
"errors"