mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
* move kv helpers to helpers_kv*.go * change KVGetJSON return signature Return a boolean and an error, to clearly indicate if no value was found and thus no value unmarshalled into the target interface. Also fix an issue with CompareAndSet to allow an oldValue of nil (i.e. expected to be unset). * add missing license * tweak documentation * document KVSetWithExpiryJSON minimum version
105 lines
2.5 KiB
Go
105 lines
2.5 KiB
Go
// Code generated by mockery v1.0.0. DO NOT EDIT.
|
|
|
|
// Regenerate this file using `make plugin-mocks`.
|
|
|
|
package plugintest
|
|
|
|
import mock "github.com/stretchr/testify/mock"
|
|
import model "github.com/mattermost/mattermost-server/model"
|
|
|
|
// Helpers is an autogenerated mock type for the Helpers type
|
|
type Helpers struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// EnsureBot provides a mock function with given fields: bot
|
|
func (_m *Helpers) EnsureBot(bot *model.Bot) (string, error) {
|
|
ret := _m.Called(bot)
|
|
|
|
var r0 string
|
|
if rf, ok := ret.Get(0).(func(*model.Bot) string); ok {
|
|
r0 = rf(bot)
|
|
} else {
|
|
r0 = ret.Get(0).(string)
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(*model.Bot) error); ok {
|
|
r1 = rf(bot)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// KVCompareAndSetJSON provides a mock function with given fields: key, oldValue, newValue
|
|
func (_m *Helpers) KVCompareAndSetJSON(key string, oldValue interface{}, newValue interface{}) (bool, error) {
|
|
ret := _m.Called(key, oldValue, newValue)
|
|
|
|
var r0 bool
|
|
if rf, ok := ret.Get(0).(func(string, interface{}, interface{}) bool); ok {
|
|
r0 = rf(key, oldValue, newValue)
|
|
} else {
|
|
r0 = ret.Get(0).(bool)
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(string, interface{}, interface{}) error); ok {
|
|
r1 = rf(key, oldValue, newValue)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// KVGetJSON provides a mock function with given fields: key, value
|
|
func (_m *Helpers) KVGetJSON(key string, value interface{}) (bool, error) {
|
|
ret := _m.Called(key, value)
|
|
|
|
var r0 bool
|
|
if rf, ok := ret.Get(0).(func(string, interface{}) bool); ok {
|
|
r0 = rf(key, value)
|
|
} else {
|
|
r0 = ret.Get(0).(bool)
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(string, interface{}) error); ok {
|
|
r1 = rf(key, value)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// KVSetJSON provides a mock function with given fields: key, value
|
|
func (_m *Helpers) KVSetJSON(key string, value interface{}) error {
|
|
ret := _m.Called(key, value)
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(string, interface{}) error); ok {
|
|
r0 = rf(key, value)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// KVSetWithExpiryJSON provides a mock function with given fields: key, value, expireInSeconds
|
|
func (_m *Helpers) KVSetWithExpiryJSON(key string, value interface{}, expireInSeconds int64) error {
|
|
ret := _m.Called(key, value, expireInSeconds)
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(string, interface{}, int64) error); ok {
|
|
r0 = rf(key, value, expireInSeconds)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|