Documentation
¶
Index ¶
- Constants
- func AssertNotified(t *testing.T, notify chan lua.LValue)
- func DeliverToStore(t *testing.T, store storage.Store, mailbox string, subject string, ...) (string, int64)
- func GetAndCountMessages(t *testing.T, s storage.Store, mailbox string, count int) []storage.Message
- func NewLuaState() (*lua.LState, *strings.Builder)
- func StoreSuite(t *testing.T, factory StoreFactory)
- type ManagerStub
- func (m *ManagerStub) AddMessage(mailbox string, msg *message.Message)
- func (m *ManagerStub) GetMessage(mailbox, id string) (*message.Message, error)
- func (m *ManagerStub) GetMetadata(mailbox string) ([]*event.MessageMetadata, error)
- func (m *ManagerStub) MailboxForAddress(address string) (string, error)
- func (m *ManagerStub) MarkSeen(mailbox, id string) error
- type MessageStub
- type StoreFactory
- type StoreStub
- func (s *StoreStub) AddMessage(m storage.Message) (id string, err error)
- func (s *StoreStub) GetMessage(mailbox, id string) (storage.Message, error)
- func (s *StoreStub) GetMessages(mailbox string) ([]storage.Message, error)
- func (s *StoreStub) MarkSeen(mailbox, id string) error
- func (s *StoreStub) MessageDeleted(m storage.Message) bool
- func (s *StoreStub) PurgeMessages(mailbox string) error
- func (s *StoreStub) RemoveMessage(mailbox, id string) error
- func (s *StoreStub) VisitMailboxes(f func([]storage.Message) (cont bool)) error
Constants ¶
const LuaInit = `` /* 1183-byte string literal not displayed */
LuaInit holds useful test globals.
Variables ¶
This section is empty.
Functions ¶
func AssertNotified ¶
AssertNotified requires a truthy LValue on the notify channel.
func DeliverToStore ¶
func DeliverToStore( t *testing.T, store storage.Store, mailbox string, subject string, date time.Time, ) (string, int64)
DeliverToStore creates and delivers a message to the specific mailbox, returning the size of the generated message.
func GetAndCountMessages ¶
func GetAndCountMessages(t *testing.T, s storage.Store, mailbox string, count int) []storage.Message
GetAndCountMessages is a test helper that expects to receive count messages or fails the test, it also checks return error.
func NewLuaState ¶
NewLuaState creates a new Lua LState initialized with logging and the test helpers in `LuaInit`.
Returns a pointer to the created LState and a string builder to hold the log output.
func StoreSuite ¶
func StoreSuite(t *testing.T, factory StoreFactory)
StoreSuite runs a set of general tests on the provided Store.
Types ¶
type ManagerStub ¶
ManagerStub is a test stub for message.Manager
func (*ManagerStub) AddMessage ¶
func (m *ManagerStub) AddMessage(mailbox string, msg *message.Message)
AddMessage adds a message to the specified mailbox.
func (*ManagerStub) GetMessage ¶
func (m *ManagerStub) GetMessage(mailbox, id string) (*message.Message, error)
GetMessage gets a message by ID from the specified mailbox.
func (*ManagerStub) GetMetadata ¶
func (m *ManagerStub) GetMetadata(mailbox string) ([]*event.MessageMetadata, error)
GetMetadata gets all the metadata for the specified mailbox.
func (*ManagerStub) MailboxForAddress ¶
func (m *ManagerStub) MailboxForAddress(address string) (string, error)
MailboxForAddress invokes policy.ParseMailboxName.
func (*ManagerStub) MarkSeen ¶
func (m *ManagerStub) MarkSeen(mailbox, id string) error
MarkSeen marks a message as having been read.
type MessageStub ¶
MessageStub wraps a storage.Message with "seen" functionality.
func (*MessageStub) Seen ¶
func (m *MessageStub) Seen() bool
Seen returns true if the message has been marked as seen previously.
type StoreFactory ¶
type StoreFactory func( config.Storage, *extension.Host) (store storage.Store, destroy func(), err error)
StoreFactory returns a new store for the test suite.
type StoreStub ¶
StoreStub stubs storage.Store for testing.
func (*StoreStub) AddMessage ¶
AddMessage adds a message to the specified mailbox.
func (*StoreStub) GetMessage ¶
GetMessage gets a message by ID from the specified mailbox.
func (*StoreStub) GetMessages ¶
GetMessages gets all the messages for the specified mailbox.
func (*StoreStub) MessageDeleted ¶
MessageDeleted returns true if the specified message was deleted
func (*StoreStub) PurgeMessages ¶
PurgeMessages deletes the contents of a mailbox.
func (*StoreStub) RemoveMessage ¶
RemoveMessage deletes a message by ID from the specified mailbox.