mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-19 02:27:03 +00:00
storage: More refactoring for #69
- retention: Start from pkg main instead of server/smtp - file: Remove DefaultStore() constructor - storage: AllMailboxes replaced with VisitMailboxes for #69 - test: Stub VisitMailboxes for #80
This commit is contained in:
@@ -39,17 +39,17 @@ func (m *MockDataStore) MailboxFor(name string) (Mailbox, error) {
|
||||
return args.Get(0).(Mailbox), args.Error(1)
|
||||
}
|
||||
|
||||
// AllMailboxes mock function
|
||||
func (m *MockDataStore) AllMailboxes() ([]Mailbox, error) {
|
||||
args := m.Called()
|
||||
return args.Get(0).([]Mailbox), args.Error(1)
|
||||
}
|
||||
|
||||
// LockFor mock function returns a new RWMutex, never errors.
|
||||
func (m *MockDataStore) LockFor(name string) (*sync.RWMutex, error) {
|
||||
return &sync.RWMutex{}, nil
|
||||
}
|
||||
|
||||
// VisitMailboxes accepts a function that will be called with the messages in each mailbox while it
|
||||
// continues to return true.
|
||||
func (m *MockDataStore) VisitMailboxes(f func([]Message) (cont bool)) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MockMailbox is a shared mock for unit testing
|
||||
type MockMailbox struct {
|
||||
mock.Mock
|
||||
|
||||
Reference in New Issue
Block a user