Documentation
¶
Index ¶
- type DetectedSpamMock
- func (mock *DetectedSpamMock) FindByUserID(ctx context.Context, userID int64) (*storage.DetectedSpamInfo, error)
- func (mock *DetectedSpamMock) FindByUserIDCalls() []struct{ ... }
- func (mock *DetectedSpamMock) Read(ctx context.Context) ([]storage.DetectedSpamInfo, error)
- func (mock *DetectedSpamMock) ReadCalls() []struct{ ... }
- func (mock *DetectedSpamMock) ResetCalls()
- func (mock *DetectedSpamMock) ResetFindByUserIDCalls()
- func (mock *DetectedSpamMock) ResetReadCalls()
- func (mock *DetectedSpamMock) ResetSetAddedToSamplesFlagCalls()
- func (mock *DetectedSpamMock) SetAddedToSamplesFlag(ctx context.Context, id int64) error
- func (mock *DetectedSpamMock) SetAddedToSamplesFlagCalls() []struct{ ... }
- type DetectorMock
- func (mock *DetectorMock) AddApprovedUser(user approved.UserInfo) error
- func (mock *DetectorMock) AddApprovedUserCalls() []struct{ ... }
- func (mock *DetectorMock) ApprovedUsers() []approved.UserInfo
- func (mock *DetectorMock) ApprovedUsersCalls() []struct{}
- func (mock *DetectorMock) Check(req spamcheck.Request) (bool, []spamcheck.Response)
- func (mock *DetectorMock) CheckCalls() []struct{ ... }
- func (mock *DetectorMock) GetLuaPluginNames() []string
- func (mock *DetectorMock) GetLuaPluginNamesCalls() []struct{}
- func (mock *DetectorMock) RemoveApprovedUser(id string) error
- func (mock *DetectorMock) RemoveApprovedUserCalls() []struct{ ... }
- func (mock *DetectorMock) ResetAddApprovedUserCalls()
- func (mock *DetectorMock) ResetApprovedUsersCalls()
- func (mock *DetectorMock) ResetCalls()
- func (mock *DetectorMock) ResetCheckCalls()
- func (mock *DetectorMock) ResetGetLuaPluginNamesCalls()
- func (mock *DetectorMock) ResetRemoveApprovedUserCalls()
- type DictionaryMock
- func (mock *DictionaryMock) Add(ctx context.Context, t storage.DictionaryType, data string) error
- func (mock *DictionaryMock) AddCalls() []struct{ ... }
- func (mock *DictionaryMock) Delete(ctx context.Context, id int64) error
- func (mock *DictionaryMock) DeleteCalls() []struct{ ... }
- func (mock *DictionaryMock) Read(ctx context.Context, t storage.DictionaryType) ([]string, error)
- func (mock *DictionaryMock) ReadCalls() []struct{ ... }
- func (mock *DictionaryMock) ReadWithIDs(ctx context.Context, t storage.DictionaryType) ([]storage.DictionaryEntry, error)
- func (mock *DictionaryMock) ReadWithIDsCalls() []struct{ ... }
- func (mock *DictionaryMock) ResetAddCalls()
- func (mock *DictionaryMock) ResetCalls()
- func (mock *DictionaryMock) ResetDeleteCalls()
- func (mock *DictionaryMock) ResetReadCalls()
- func (mock *DictionaryMock) ResetReadWithIDsCalls()
- func (mock *DictionaryMock) ResetStatsCalls()
- func (mock *DictionaryMock) Stats(ctx context.Context) (*storage.DictionaryStats, error)
- func (mock *DictionaryMock) StatsCalls() []struct{ ... }
- type LocatorMock
- func (mock *LocatorMock) ResetCalls()
- func (mock *LocatorMock) ResetUserIDByNameCalls()
- func (mock *LocatorMock) ResetUserNameByIDCalls()
- func (mock *LocatorMock) UserIDByName(ctx context.Context, userName string) int64
- func (mock *LocatorMock) UserIDByNameCalls() []struct{ ... }
- func (mock *LocatorMock) UserNameByID(ctx context.Context, userID int64) string
- func (mock *LocatorMock) UserNameByIDCalls() []struct{ ... }
- type SpamFilterMock
- func (mock *SpamFilterMock) DynamicSamples() ([]string, []string, error)
- func (mock *SpamFilterMock) DynamicSamplesCalls() []struct{}
- func (mock *SpamFilterMock) ReloadSamples() error
- func (mock *SpamFilterMock) ReloadSamplesCalls() []struct{}
- func (mock *SpamFilterMock) RemoveDynamicHamSample(sample string) error
- func (mock *SpamFilterMock) RemoveDynamicHamSampleCalls() []struct{ ... }
- func (mock *SpamFilterMock) RemoveDynamicSpamSample(sample string) error
- func (mock *SpamFilterMock) RemoveDynamicSpamSampleCalls() []struct{ ... }
- func (mock *SpamFilterMock) ResetCalls()
- func (mock *SpamFilterMock) ResetDynamicSamplesCalls()
- func (mock *SpamFilterMock) ResetReloadSamplesCalls()
- func (mock *SpamFilterMock) ResetRemoveDynamicHamSampleCalls()
- func (mock *SpamFilterMock) ResetRemoveDynamicSpamSampleCalls()
- func (mock *SpamFilterMock) ResetUpdateHamCalls()
- func (mock *SpamFilterMock) ResetUpdateSpamCalls()
- func (mock *SpamFilterMock) UpdateHam(msg string) error
- func (mock *SpamFilterMock) UpdateHamCalls() []struct{ ... }
- func (mock *SpamFilterMock) UpdateSpam(msg string) error
- func (mock *SpamFilterMock) UpdateSpamCalls() []struct{ ... }
- type StorageEngineMock
- func (mock *StorageEngineMock) Backup(ctx context.Context, w io.Writer) error
- func (mock *StorageEngineMock) BackupCalls() []struct{ ... }
- func (mock *StorageEngineMock) BackupSqliteAsPostgres(ctx context.Context, w io.Writer) error
- func (mock *StorageEngineMock) BackupSqliteAsPostgresCalls() []struct{ ... }
- func (mock *StorageEngineMock) ResetBackupCalls()
- func (mock *StorageEngineMock) ResetBackupSqliteAsPostgresCalls()
- func (mock *StorageEngineMock) ResetCalls()
- func (mock *StorageEngineMock) ResetTypeCalls()
- func (mock *StorageEngineMock) Type() engine.Type
- func (mock *StorageEngineMock) TypeCalls() []struct{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DetectedSpamMock ¶ added in v1.10.0
type DetectedSpamMock struct {
// FindByUserIDFunc mocks the FindByUserID method.
FindByUserIDFunc func(ctx context.Context, userID int64) (*storage.DetectedSpamInfo, error)
// ReadFunc mocks the Read method.
ReadFunc func(ctx context.Context) ([]storage.DetectedSpamInfo, error)
// SetAddedToSamplesFlagFunc mocks the SetAddedToSamplesFlag method.
SetAddedToSamplesFlagFunc func(ctx context.Context, id int64) error
// contains filtered or unexported fields
}
DetectedSpamMock is a mock implementation of webapi.DetectedSpam.
func TestSomethingThatUsesDetectedSpam(t *testing.T) {
// make and configure a mocked webapi.DetectedSpam
mockedDetectedSpam := &DetectedSpamMock{
FindByUserIDFunc: func(ctx context.Context, userID int64) (*storage.DetectedSpamInfo, error) {
panic("mock out the FindByUserID method")
},
ReadFunc: func(ctx context.Context) ([]storage.DetectedSpamInfo, error) {
panic("mock out the Read method")
},
SetAddedToSamplesFlagFunc: func(ctx context.Context, id int64) error {
panic("mock out the SetAddedToSamplesFlag method")
},
}
// use mockedDetectedSpam in code that requires webapi.DetectedSpam
// and then make assertions.
}
func (*DetectedSpamMock) FindByUserID ¶ added in v1.16.0
func (mock *DetectedSpamMock) FindByUserID(ctx context.Context, userID int64) (*storage.DetectedSpamInfo, error)
FindByUserID calls FindByUserIDFunc.
func (*DetectedSpamMock) FindByUserIDCalls ¶ added in v1.16.0
func (mock *DetectedSpamMock) FindByUserIDCalls() []struct { Ctx context.Context UserID int64 }
FindByUserIDCalls gets all the calls that were made to FindByUserID. Check the length with:
len(mockedDetectedSpam.FindByUserIDCalls())
func (*DetectedSpamMock) Read ¶ added in v1.10.0
func (mock *DetectedSpamMock) Read(ctx context.Context) ([]storage.DetectedSpamInfo, error)
Read calls ReadFunc.
func (*DetectedSpamMock) ReadCalls ¶ added in v1.10.0
func (mock *DetectedSpamMock) ReadCalls() []struct { Ctx context.Context }
ReadCalls gets all the calls that were made to Read. Check the length with:
len(mockedDetectedSpam.ReadCalls())
func (*DetectedSpamMock) ResetCalls ¶ added in v1.10.0
func (mock *DetectedSpamMock) ResetCalls()
ResetCalls reset all the calls that were made to all mocked methods.
func (*DetectedSpamMock) ResetFindByUserIDCalls ¶ added in v1.16.0
func (mock *DetectedSpamMock) ResetFindByUserIDCalls()
ResetFindByUserIDCalls reset all the calls that were made to FindByUserID.
func (*DetectedSpamMock) ResetReadCalls ¶ added in v1.10.0
func (mock *DetectedSpamMock) ResetReadCalls()
ResetReadCalls reset all the calls that were made to Read.
func (*DetectedSpamMock) ResetSetAddedToSamplesFlagCalls ¶ added in v1.10.0
func (mock *DetectedSpamMock) ResetSetAddedToSamplesFlagCalls()
ResetSetAddedToSamplesFlagCalls reset all the calls that were made to SetAddedToSamplesFlag.
func (*DetectedSpamMock) SetAddedToSamplesFlag ¶ added in v1.10.0
func (mock *DetectedSpamMock) SetAddedToSamplesFlag(ctx context.Context, id int64) error
SetAddedToSamplesFlag calls SetAddedToSamplesFlagFunc.
func (*DetectedSpamMock) SetAddedToSamplesFlagCalls ¶ added in v1.10.0
func (mock *DetectedSpamMock) SetAddedToSamplesFlagCalls() []struct { Ctx context.Context ID int64 }
SetAddedToSamplesFlagCalls gets all the calls that were made to SetAddedToSamplesFlag. Check the length with:
len(mockedDetectedSpam.SetAddedToSamplesFlagCalls())
type DetectorMock ¶
type DetectorMock struct {
// AddApprovedUserFunc mocks the AddApprovedUser method.
AddApprovedUserFunc func(user approved.UserInfo) error
// ApprovedUsersFunc mocks the ApprovedUsers method.
ApprovedUsersFunc func() []approved.UserInfo
// CheckFunc mocks the Check method.
CheckFunc func(req spamcheck.Request) (bool, []spamcheck.Response)
// GetLuaPluginNamesFunc mocks the GetLuaPluginNames method.
GetLuaPluginNamesFunc func() []string
// RemoveApprovedUserFunc mocks the RemoveApprovedUser method.
RemoveApprovedUserFunc func(id string) error
// contains filtered or unexported fields
}
DetectorMock is a mock implementation of webapi.Detector.
func TestSomethingThatUsesDetector(t *testing.T) {
// make and configure a mocked webapi.Detector
mockedDetector := &DetectorMock{
AddApprovedUserFunc: func(user approved.UserInfo) error {
panic("mock out the AddApprovedUser method")
},
ApprovedUsersFunc: func() []approved.UserInfo {
panic("mock out the ApprovedUsers method")
},
CheckFunc: func(req spamcheck.Request) (bool, []spamcheck.Response) {
panic("mock out the Check method")
},
GetLuaPluginNamesFunc: func() []string {
panic("mock out the GetLuaPluginNames method")
},
RemoveApprovedUserFunc: func(id string) error {
panic("mock out the RemoveApprovedUser method")
},
}
// use mockedDetector in code that requires webapi.Detector
// and then make assertions.
}
func (*DetectorMock) AddApprovedUser ¶ added in v1.6.0
func (mock *DetectorMock) AddApprovedUser(user approved.UserInfo) error
AddApprovedUser calls AddApprovedUserFunc.
func (*DetectorMock) AddApprovedUserCalls ¶ added in v1.6.0
func (mock *DetectorMock) AddApprovedUserCalls() []struct { User approved.UserInfo }
AddApprovedUserCalls gets all the calls that were made to AddApprovedUser. Check the length with:
len(mockedDetector.AddApprovedUserCalls())
func (*DetectorMock) ApprovedUsers ¶
func (mock *DetectorMock) ApprovedUsers() []approved.UserInfo
ApprovedUsers calls ApprovedUsersFunc.
func (*DetectorMock) ApprovedUsersCalls ¶
func (mock *DetectorMock) ApprovedUsersCalls() []struct { }
ApprovedUsersCalls gets all the calls that were made to ApprovedUsers. Check the length with:
len(mockedDetector.ApprovedUsersCalls())
func (*DetectorMock) CheckCalls ¶
func (mock *DetectorMock) CheckCalls() []struct { Req spamcheck.Request }
CheckCalls gets all the calls that were made to Check. Check the length with:
len(mockedDetector.CheckCalls())
func (*DetectorMock) GetLuaPluginNames ¶ added in v1.18.1
func (mock *DetectorMock) GetLuaPluginNames() []string
GetLuaPluginNames calls GetLuaPluginNamesFunc.
func (*DetectorMock) GetLuaPluginNamesCalls ¶ added in v1.18.1
func (mock *DetectorMock) GetLuaPluginNamesCalls() []struct { }
GetLuaPluginNamesCalls gets all the calls that were made to GetLuaPluginNames. Check the length with:
len(mockedDetector.GetLuaPluginNamesCalls())
func (*DetectorMock) RemoveApprovedUser ¶ added in v1.6.0
func (mock *DetectorMock) RemoveApprovedUser(id string) error
RemoveApprovedUser calls RemoveApprovedUserFunc.
func (*DetectorMock) RemoveApprovedUserCalls ¶ added in v1.6.0
func (mock *DetectorMock) RemoveApprovedUserCalls() []struct { ID string }
RemoveApprovedUserCalls gets all the calls that were made to RemoveApprovedUser. Check the length with:
len(mockedDetector.RemoveApprovedUserCalls())
func (*DetectorMock) ResetAddApprovedUserCalls ¶ added in v1.6.0
func (mock *DetectorMock) ResetAddApprovedUserCalls()
ResetAddApprovedUserCalls reset all the calls that were made to AddApprovedUser.
func (*DetectorMock) ResetApprovedUsersCalls ¶
func (mock *DetectorMock) ResetApprovedUsersCalls()
ResetApprovedUsersCalls reset all the calls that were made to ApprovedUsers.
func (*DetectorMock) ResetCalls ¶
func (mock *DetectorMock) ResetCalls()
ResetCalls reset all the calls that were made to all mocked methods.
func (*DetectorMock) ResetCheckCalls ¶
func (mock *DetectorMock) ResetCheckCalls()
ResetCheckCalls reset all the calls that were made to Check.
func (*DetectorMock) ResetGetLuaPluginNamesCalls ¶ added in v1.18.1
func (mock *DetectorMock) ResetGetLuaPluginNamesCalls()
ResetGetLuaPluginNamesCalls reset all the calls that were made to GetLuaPluginNames.
func (*DetectorMock) ResetRemoveApprovedUserCalls ¶ added in v1.6.0
func (mock *DetectorMock) ResetRemoveApprovedUserCalls()
ResetRemoveApprovedUserCalls reset all the calls that were made to RemoveApprovedUser.
type DictionaryMock ¶ added in v1.21.0
type DictionaryMock struct {
// AddFunc mocks the Add method.
AddFunc func(ctx context.Context, t storage.DictionaryType, data string) error
// DeleteFunc mocks the Delete method.
DeleteFunc func(ctx context.Context, id int64) error
// ReadFunc mocks the Read method.
ReadFunc func(ctx context.Context, t storage.DictionaryType) ([]string, error)
// ReadWithIDsFunc mocks the ReadWithIDs method.
ReadWithIDsFunc func(ctx context.Context, t storage.DictionaryType) ([]storage.DictionaryEntry, error)
// StatsFunc mocks the Stats method.
StatsFunc func(ctx context.Context) (*storage.DictionaryStats, error)
// contains filtered or unexported fields
}
DictionaryMock is a mock implementation of webapi.Dictionary.
func TestSomethingThatUsesDictionary(t *testing.T) {
// make and configure a mocked webapi.Dictionary
mockedDictionary := &DictionaryMock{
AddFunc: func(ctx context.Context, t storage.DictionaryType, data string) error {
panic("mock out the Add method")
},
DeleteFunc: func(ctx context.Context, id int64) error {
panic("mock out the Delete method")
},
ReadFunc: func(ctx context.Context, t storage.DictionaryType) ([]string, error) {
panic("mock out the Read method")
},
ReadWithIDsFunc: func(ctx context.Context, t storage.DictionaryType) ([]storage.DictionaryEntry, error) {
panic("mock out the ReadWithIDs method")
},
StatsFunc: func(ctx context.Context) (*storage.DictionaryStats, error) {
panic("mock out the Stats method")
},
}
// use mockedDictionary in code that requires webapi.Dictionary
// and then make assertions.
}
func (*DictionaryMock) Add ¶ added in v1.21.0
func (mock *DictionaryMock) Add(ctx context.Context, t storage.DictionaryType, data string) error
Add calls AddFunc.
func (*DictionaryMock) AddCalls ¶ added in v1.21.0
func (mock *DictionaryMock) AddCalls() []struct { Ctx context.Context T storage.DictionaryType Data string }
AddCalls gets all the calls that were made to Add. Check the length with:
len(mockedDictionary.AddCalls())
func (*DictionaryMock) Delete ¶ added in v1.21.0
func (mock *DictionaryMock) Delete(ctx context.Context, id int64) error
Delete calls DeleteFunc.
func (*DictionaryMock) DeleteCalls ¶ added in v1.21.0
func (mock *DictionaryMock) DeleteCalls() []struct { Ctx context.Context ID int64 }
DeleteCalls gets all the calls that were made to Delete. Check the length with:
len(mockedDictionary.DeleteCalls())
func (*DictionaryMock) Read ¶ added in v1.21.0
func (mock *DictionaryMock) Read(ctx context.Context, t storage.DictionaryType) ([]string, error)
Read calls ReadFunc.
func (*DictionaryMock) ReadCalls ¶ added in v1.21.0
func (mock *DictionaryMock) ReadCalls() []struct { Ctx context.Context T storage.DictionaryType }
ReadCalls gets all the calls that were made to Read. Check the length with:
len(mockedDictionary.ReadCalls())
func (*DictionaryMock) ReadWithIDs ¶ added in v1.21.0
func (mock *DictionaryMock) ReadWithIDs(ctx context.Context, t storage.DictionaryType) ([]storage.DictionaryEntry, error)
ReadWithIDs calls ReadWithIDsFunc.
func (*DictionaryMock) ReadWithIDsCalls ¶ added in v1.21.0
func (mock *DictionaryMock) ReadWithIDsCalls() []struct { Ctx context.Context T storage.DictionaryType }
ReadWithIDsCalls gets all the calls that were made to ReadWithIDs. Check the length with:
len(mockedDictionary.ReadWithIDsCalls())
func (*DictionaryMock) ResetAddCalls ¶ added in v1.21.0
func (mock *DictionaryMock) ResetAddCalls()
ResetAddCalls reset all the calls that were made to Add.
func (*DictionaryMock) ResetCalls ¶ added in v1.21.0
func (mock *DictionaryMock) ResetCalls()
ResetCalls reset all the calls that were made to all mocked methods.
func (*DictionaryMock) ResetDeleteCalls ¶ added in v1.21.0
func (mock *DictionaryMock) ResetDeleteCalls()
ResetDeleteCalls reset all the calls that were made to Delete.
func (*DictionaryMock) ResetReadCalls ¶ added in v1.21.0
func (mock *DictionaryMock) ResetReadCalls()
ResetReadCalls reset all the calls that were made to Read.
func (*DictionaryMock) ResetReadWithIDsCalls ¶ added in v1.21.0
func (mock *DictionaryMock) ResetReadWithIDsCalls()
ResetReadWithIDsCalls reset all the calls that were made to ReadWithIDs.
func (*DictionaryMock) ResetStatsCalls ¶ added in v1.21.0
func (mock *DictionaryMock) ResetStatsCalls()
ResetStatsCalls reset all the calls that were made to Stats.
func (*DictionaryMock) Stats ¶ added in v1.21.0
func (mock *DictionaryMock) Stats(ctx context.Context) (*storage.DictionaryStats, error)
Stats calls StatsFunc.
func (*DictionaryMock) StatsCalls ¶ added in v1.21.0
func (mock *DictionaryMock) StatsCalls() []struct { Ctx context.Context }
StatsCalls gets all the calls that were made to Stats. Check the length with:
len(mockedDictionary.StatsCalls())
type LocatorMock ¶ added in v1.5.0
type LocatorMock struct {
// UserIDByNameFunc mocks the UserIDByName method.
UserIDByNameFunc func(ctx context.Context, userName string) int64
// UserNameByIDFunc mocks the UserNameByID method.
UserNameByIDFunc func(ctx context.Context, userID int64) string
// contains filtered or unexported fields
}
LocatorMock is a mock implementation of webapi.Locator.
func TestSomethingThatUsesLocator(t *testing.T) {
// make and configure a mocked webapi.Locator
mockedLocator := &LocatorMock{
UserIDByNameFunc: func(ctx context.Context, userName string) int64 {
panic("mock out the UserIDByName method")
},
UserNameByIDFunc: func(ctx context.Context, userID int64) string {
panic("mock out the UserNameByID method")
},
}
// use mockedLocator in code that requires webapi.Locator
// and then make assertions.
}
func (*LocatorMock) ResetCalls ¶ added in v1.5.0
func (mock *LocatorMock) ResetCalls()
ResetCalls reset all the calls that were made to all mocked methods.
func (*LocatorMock) ResetUserIDByNameCalls ¶ added in v1.5.0
func (mock *LocatorMock) ResetUserIDByNameCalls()
ResetUserIDByNameCalls reset all the calls that were made to UserIDByName.
func (*LocatorMock) ResetUserNameByIDCalls ¶ added in v1.5.0
func (mock *LocatorMock) ResetUserNameByIDCalls()
ResetUserNameByIDCalls reset all the calls that were made to UserNameByID.
func (*LocatorMock) UserIDByName ¶ added in v1.5.0
func (mock *LocatorMock) UserIDByName(ctx context.Context, userName string) int64
UserIDByName calls UserIDByNameFunc.
func (*LocatorMock) UserIDByNameCalls ¶ added in v1.5.0
func (mock *LocatorMock) UserIDByNameCalls() []struct { Ctx context.Context UserName string }
UserIDByNameCalls gets all the calls that were made to UserIDByName. Check the length with:
len(mockedLocator.UserIDByNameCalls())
func (*LocatorMock) UserNameByID ¶ added in v1.5.0
func (mock *LocatorMock) UserNameByID(ctx context.Context, userID int64) string
UserNameByID calls UserNameByIDFunc.
func (*LocatorMock) UserNameByIDCalls ¶ added in v1.5.0
func (mock *LocatorMock) UserNameByIDCalls() []struct { Ctx context.Context UserID int64 }
UserNameByIDCalls gets all the calls that were made to UserNameByID. Check the length with:
len(mockedLocator.UserNameByIDCalls())
type SpamFilterMock ¶ added in v1.5.0
type SpamFilterMock struct {
// DynamicSamplesFunc mocks the DynamicSamples method.
DynamicSamplesFunc func() ([]string, []string, error)
// ReloadSamplesFunc mocks the ReloadSamples method.
ReloadSamplesFunc func() error
// RemoveDynamicHamSampleFunc mocks the RemoveDynamicHamSample method.
RemoveDynamicHamSampleFunc func(sample string) error
// RemoveDynamicSpamSampleFunc mocks the RemoveDynamicSpamSample method.
RemoveDynamicSpamSampleFunc func(sample string) error
// UpdateHamFunc mocks the UpdateHam method.
UpdateHamFunc func(msg string) error
// UpdateSpamFunc mocks the UpdateSpam method.
UpdateSpamFunc func(msg string) error
// contains filtered or unexported fields
}
SpamFilterMock is a mock implementation of webapi.SpamFilter.
func TestSomethingThatUsesSpamFilter(t *testing.T) {
// make and configure a mocked webapi.SpamFilter
mockedSpamFilter := &SpamFilterMock{
DynamicSamplesFunc: func() ([]string, []string, error) {
panic("mock out the DynamicSamples method")
},
ReloadSamplesFunc: func() error {
panic("mock out the ReloadSamples method")
},
RemoveDynamicHamSampleFunc: func(sample string) error {
panic("mock out the RemoveDynamicHamSample method")
},
RemoveDynamicSpamSampleFunc: func(sample string) error {
panic("mock out the RemoveDynamicSpamSample method")
},
UpdateHamFunc: func(msg string) error {
panic("mock out the UpdateHam method")
},
UpdateSpamFunc: func(msg string) error {
panic("mock out the UpdateSpam method")
},
}
// use mockedSpamFilter in code that requires webapi.SpamFilter
// and then make assertions.
}
func (*SpamFilterMock) DynamicSamples ¶ added in v1.5.0
func (mock *SpamFilterMock) DynamicSamples() ([]string, []string, error)
DynamicSamples calls DynamicSamplesFunc.
func (*SpamFilterMock) DynamicSamplesCalls ¶ added in v1.5.0
func (mock *SpamFilterMock) DynamicSamplesCalls() []struct { }
DynamicSamplesCalls gets all the calls that were made to DynamicSamples. Check the length with:
len(mockedSpamFilter.DynamicSamplesCalls())
func (*SpamFilterMock) ReloadSamples ¶ added in v1.5.0
func (mock *SpamFilterMock) ReloadSamples() error
ReloadSamples calls ReloadSamplesFunc.
func (*SpamFilterMock) ReloadSamplesCalls ¶ added in v1.5.0
func (mock *SpamFilterMock) ReloadSamplesCalls() []struct { }
ReloadSamplesCalls gets all the calls that were made to ReloadSamples. Check the length with:
len(mockedSpamFilter.ReloadSamplesCalls())
func (*SpamFilterMock) RemoveDynamicHamSample ¶ added in v1.5.0
func (mock *SpamFilterMock) RemoveDynamicHamSample(sample string) error
RemoveDynamicHamSample calls RemoveDynamicHamSampleFunc.
func (*SpamFilterMock) RemoveDynamicHamSampleCalls ¶ added in v1.5.0
func (mock *SpamFilterMock) RemoveDynamicHamSampleCalls() []struct { Sample string }
RemoveDynamicHamSampleCalls gets all the calls that were made to RemoveDynamicHamSample. Check the length with:
len(mockedSpamFilter.RemoveDynamicHamSampleCalls())
func (*SpamFilterMock) RemoveDynamicSpamSample ¶ added in v1.5.0
func (mock *SpamFilterMock) RemoveDynamicSpamSample(sample string) error
RemoveDynamicSpamSample calls RemoveDynamicSpamSampleFunc.
func (*SpamFilterMock) RemoveDynamicSpamSampleCalls ¶ added in v1.5.0
func (mock *SpamFilterMock) RemoveDynamicSpamSampleCalls() []struct { Sample string }
RemoveDynamicSpamSampleCalls gets all the calls that were made to RemoveDynamicSpamSample. Check the length with:
len(mockedSpamFilter.RemoveDynamicSpamSampleCalls())
func (*SpamFilterMock) ResetCalls ¶ added in v1.5.0
func (mock *SpamFilterMock) ResetCalls()
ResetCalls reset all the calls that were made to all mocked methods.
func (*SpamFilterMock) ResetDynamicSamplesCalls ¶ added in v1.5.0
func (mock *SpamFilterMock) ResetDynamicSamplesCalls()
ResetDynamicSamplesCalls reset all the calls that were made to DynamicSamples.
func (*SpamFilterMock) ResetReloadSamplesCalls ¶ added in v1.5.0
func (mock *SpamFilterMock) ResetReloadSamplesCalls()
ResetReloadSamplesCalls reset all the calls that were made to ReloadSamples.
func (*SpamFilterMock) ResetRemoveDynamicHamSampleCalls ¶ added in v1.5.0
func (mock *SpamFilterMock) ResetRemoveDynamicHamSampleCalls()
ResetRemoveDynamicHamSampleCalls reset all the calls that were made to RemoveDynamicHamSample.
func (*SpamFilterMock) ResetRemoveDynamicSpamSampleCalls ¶ added in v1.5.0
func (mock *SpamFilterMock) ResetRemoveDynamicSpamSampleCalls()
ResetRemoveDynamicSpamSampleCalls reset all the calls that were made to RemoveDynamicSpamSample.
func (*SpamFilterMock) ResetUpdateHamCalls ¶ added in v1.5.0
func (mock *SpamFilterMock) ResetUpdateHamCalls()
ResetUpdateHamCalls reset all the calls that were made to UpdateHam.
func (*SpamFilterMock) ResetUpdateSpamCalls ¶ added in v1.5.0
func (mock *SpamFilterMock) ResetUpdateSpamCalls()
ResetUpdateSpamCalls reset all the calls that were made to UpdateSpam.
func (*SpamFilterMock) UpdateHam ¶ added in v1.5.0
func (mock *SpamFilterMock) UpdateHam(msg string) error
UpdateHam calls UpdateHamFunc.
func (*SpamFilterMock) UpdateHamCalls ¶ added in v1.5.0
func (mock *SpamFilterMock) UpdateHamCalls() []struct { Msg string }
UpdateHamCalls gets all the calls that were made to UpdateHam. Check the length with:
len(mockedSpamFilter.UpdateHamCalls())
func (*SpamFilterMock) UpdateSpam ¶ added in v1.5.0
func (mock *SpamFilterMock) UpdateSpam(msg string) error
UpdateSpam calls UpdateSpamFunc.
func (*SpamFilterMock) UpdateSpamCalls ¶ added in v1.5.0
func (mock *SpamFilterMock) UpdateSpamCalls() []struct { Msg string }
UpdateSpamCalls gets all the calls that were made to UpdateSpam. Check the length with:
len(mockedSpamFilter.UpdateSpamCalls())
type StorageEngineMock ¶ added in v1.17.0
type StorageEngineMock struct {
// BackupFunc mocks the Backup method.
BackupFunc func(ctx context.Context, w io.Writer) error
// BackupSqliteAsPostgresFunc mocks the BackupSqliteAsPostgres method.
BackupSqliteAsPostgresFunc func(ctx context.Context, w io.Writer) error
// TypeFunc mocks the Type method.
TypeFunc func() engine.Type
// contains filtered or unexported fields
}
StorageEngineMock is a mock implementation of webapi.StorageEngine.
func TestSomethingThatUsesStorageEngine(t *testing.T) {
// make and configure a mocked webapi.StorageEngine
mockedStorageEngine := &StorageEngineMock{
BackupFunc: func(ctx context.Context, w io.Writer) error {
panic("mock out the Backup method")
},
BackupSqliteAsPostgresFunc: func(ctx context.Context, w io.Writer) error {
panic("mock out the BackupSqliteAsPostgres method")
},
TypeFunc: func() engine.Type {
panic("mock out the Type method")
},
}
// use mockedStorageEngine in code that requires webapi.StorageEngine
// and then make assertions.
}
func (*StorageEngineMock) BackupCalls ¶ added in v1.17.0
func (mock *StorageEngineMock) BackupCalls() []struct { Ctx context.Context W io.Writer }
BackupCalls gets all the calls that were made to Backup. Check the length with:
len(mockedStorageEngine.BackupCalls())
func (*StorageEngineMock) BackupSqliteAsPostgres ¶ added in v1.17.0
BackupSqliteAsPostgres calls BackupSqliteAsPostgresFunc.
func (*StorageEngineMock) BackupSqliteAsPostgresCalls ¶ added in v1.17.0
func (mock *StorageEngineMock) BackupSqliteAsPostgresCalls() []struct { Ctx context.Context W io.Writer }
BackupSqliteAsPostgresCalls gets all the calls that were made to BackupSqliteAsPostgres. Check the length with:
len(mockedStorageEngine.BackupSqliteAsPostgresCalls())
func (*StorageEngineMock) ResetBackupCalls ¶ added in v1.17.0
func (mock *StorageEngineMock) ResetBackupCalls()
ResetBackupCalls reset all the calls that were made to Backup.
func (*StorageEngineMock) ResetBackupSqliteAsPostgresCalls ¶ added in v1.17.0
func (mock *StorageEngineMock) ResetBackupSqliteAsPostgresCalls()
ResetBackupSqliteAsPostgresCalls reset all the calls that were made to BackupSqliteAsPostgres.
func (*StorageEngineMock) ResetCalls ¶ added in v1.17.0
func (mock *StorageEngineMock) ResetCalls()
ResetCalls reset all the calls that were made to all mocked methods.
func (*StorageEngineMock) ResetTypeCalls ¶ added in v1.17.0
func (mock *StorageEngineMock) ResetTypeCalls()
ResetTypeCalls reset all the calls that were made to Type.
func (*StorageEngineMock) Type ¶ added in v1.17.0
func (mock *StorageEngineMock) Type() engine.Type
Type calls TypeFunc.
func (*StorageEngineMock) TypeCalls ¶ added in v1.17.0
func (mock *StorageEngineMock) TypeCalls() []struct { }
TypeCalls gets all the calls that were made to Type. Check the length with:
len(mockedStorageEngine.TypeCalls())