1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-19 18:47:03 +00:00

Refactor datastore into it's own package for #67

This commit is contained in:
James Hillyerd
2017-12-26 14:54:49 -08:00
parent cc47895d71
commit 3a4fd3f093
17 changed files with 93 additions and 84 deletions

View File

@@ -6,7 +6,7 @@ import (
"time"
"github.com/jhillyerd/enmime"
"github.com/jhillyerd/inbucket/smtpd"
"github.com/jhillyerd/inbucket/datastore"
"github.com/stretchr/testify/mock"
)
@@ -15,14 +15,14 @@ type MockDataStore struct {
mock.Mock
}
func (m *MockDataStore) MailboxFor(name string) (smtpd.Mailbox, error) {
func (m *MockDataStore) MailboxFor(name string) (datastore.Mailbox, error) {
args := m.Called(name)
return args.Get(0).(smtpd.Mailbox), args.Error(1)
return args.Get(0).(datastore.Mailbox), args.Error(1)
}
func (m *MockDataStore) AllMailboxes() ([]smtpd.Mailbox, error) {
func (m *MockDataStore) AllMailboxes() ([]datastore.Mailbox, error) {
args := m.Called()
return args.Get(0).([]smtpd.Mailbox), args.Error(1)
return args.Get(0).([]datastore.Mailbox), args.Error(1)
}
// Mock Mailbox object
@@ -30,14 +30,14 @@ type MockMailbox struct {
mock.Mock
}
func (m *MockMailbox) GetMessages() ([]smtpd.Message, error) {
func (m *MockMailbox) GetMessages() ([]datastore.Message, error) {
args := m.Called()
return args.Get(0).([]smtpd.Message), args.Error(1)
return args.Get(0).([]datastore.Message), args.Error(1)
}
func (m *MockMailbox) GetMessage(id string) (smtpd.Message, error) {
func (m *MockMailbox) GetMessage(id string) (datastore.Message, error) {
args := m.Called(id)
return args.Get(0).(smtpd.Message), args.Error(1)
return args.Get(0).(datastore.Message), args.Error(1)
}
func (m *MockMailbox) Purge() error {
@@ -45,9 +45,9 @@ func (m *MockMailbox) Purge() error {
return args.Error(0)
}
func (m *MockMailbox) NewMessage() (smtpd.Message, error) {
func (m *MockMailbox) NewMessage() (datastore.Message, error) {
args := m.Called()
return args.Get(0).(smtpd.Message), args.Error(1)
return args.Get(0).(datastore.Message), args.Error(1)
}
func (m *MockMailbox) Name() string {