Documentation
¶
Overview ¶
Package contracttest is the shared suite every verification service adapter passes, like the sending adapters' suite: registration and capabilities, the balance (which sends no address), each of the four results with the service's own code, batches in order, and the errors jobs act on (a rejected key, no credits, rate limits, an outage), against a fake of the service's API that serves recorded answers.
func TestContract(t *testing.T) {
contracttest.Run(t, contracttest.Suite{Service: "zerobounce", API: fake})
}
The fake reads Env.Mode and the address in the request to choose a recorded answer: the addresses below stand for each result.
Index ¶
Constants ¶
const ( ModeOK = "" ModeAuth = "auth" // the key is rejected ModeNoCredits = "no_credits" // the account is empty ModeRateLimited = "rate_limited" // 429 or the service's throttle answer ModeOutage = "outage" // 5xx )
Modes the fake API simulates.
const ( AddrValid = "valid@contract.test" AddrInvalid = "invalid@contract.test" AddrCatchAll = "catchall@contract.test" AddrRole = "role@contract.test" AddrDisposable = "disposable@contract.test" AddrUnknown = "unknown@contract.test" // AddrSpamTrap is answered as a spam trap by services that report them. AddrSpamTrap = "trap@contract.test" )
Addresses the fake answers for, one per expected answer.
const Balance = 36656
Balance is what the fake's balance answer holds.
const Key = "contract-test-key-7f3a91c2"
Key is the API key the suite connects with.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Env ¶
type Env struct {
// contains filtered or unexported fields
}
Env is shared between the suite and the fake API.