Documentation
¶
Overview ¶
Package backendtest is the protocol backend contract (ADR 0037): one suite every backend.Receiver runs, against a fixture that starts the backend and puts mail on, or injects faults into, its server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunOnly ¶
RunOnly runs only the named parts of the contract, for a backend whose other verbs are still to come.
func RunSender ¶
func RunSender(t *testing.T, start SendFixture)
RunSender runs the sending part of the contract against the backend start gives.
Types ¶
type Delivery ¶
type Delivery struct {
Rcpts []string // the addresses it goes to
Raw []byte // as the server got it; a backend may add header fields
}
Delivery is one message a sending server accepted.
type SendFixture ¶
type SendFixture func(t *testing.T) SendServer
SendFixture starts a SendServer for one test.
type SendServer ¶
type SendServer interface {
// Sender starts a new sending backend on the account.
Sender(t *testing.T) backend.Sender
// Accepted is every message the server has accepted, in order.
Accepted(t *testing.T) []Delivery
// Refuse makes the server refuse, for good, every message to rcpt.
Refuse(t *testing.T, rcpt string)
// LoseVerdict makes the server take the whole next message and then drop
// the connection without answering.
LoseVerdict(t *testing.T)
// RejectAuth makes the server refuse the account's credentials from now on.
RejectAuth(t *testing.T)
}
SendServer is one fresh account on a fixture's sending server.
type Server ¶
type Server interface {
// Receiver starts a new backend on the account, closed when t ends.
Receiver(t *testing.T) backend.Receiver
// Deliver puts raw into the folder named folder, creating it if need be,
// as mail arriving. "INBOX" is the inbox.
Deliver(t *testing.T, folder string, raw []byte)
// Reset makes the server void every location in the folder named folder:
// IMAP's UIDVALIDITY changes, JMAP cannot calculate changes. A fixture
// that cannot calls t.Skip.
Reset(t *testing.T, folder string)
// RejectAuth makes the server refuse the account's credentials from now on.
RejectAuth(t *testing.T)
}
Server is one fresh account on a fixture's server.