Expand description
A library for testing milters.
The API provided is powerful, but rather low-level. It provides little guidance on how to interact with the milter under test. You must be familiar with the steps of an SMTP conversation. See the included tests for basic usage, and consult the sendmail API documentation.
§Usage
The purpose of indymilter-test is exercising some milter and checking that it behaves as expected. Running the milter is out of scope for this library. You must arrange for the milter to be set up and torn down yourself. In any case, indymilter-test requires to be passed a listening socket to talk to the milter under test.
The main API item is TestConnection
. Open the connection directly with
TestConnection::open
or configure it with TestConnection::configure
.
When designing a test case, keep in mind that your method calls on
TestConnection
should be those of a well-behaved MTA. The sequence of
steps will usually be: open the connection, interact with the milter under
test while asserting expected responses, close the connection. As mentioned,
familiarity with the milter protocol is assumed.
As a quick overview, the following are the SMTP commands that an MTA may forward to a milter, in order. Negotiation is done automatically when opening the test connection.
During the message-scoped commands, abort
aborts
processing for the current message. The commands indicated may be called
repeatedly.
§Cargo features
The optional feature regex
enables implementations of Matcher
for
regular expressions.
Structs§
- Actions
- Flags that represent
eom
actions. - AnyMatcher
- A matcher that accepts any input.
- EomActions
- End-of-message actions received from the milter.
- Proto
Opts - Flags that represent milter protocol options.
- Test
Connection - A milter test connection.
- Test
Connection Builder - A builder for milter test connections.
Enums§
- EomAction
- An end-of-message action performed by a milter.
- Macro
Stage - The stage for which macros are sent.
- Socket
Info - Socket information.
- Status
- The status returned for a milter command.
- Test
Error - Errors that may occur when interacting with the milter API.
Traits§
- IntoC
String - Infallible conversion to a C string.
- Into
Socket Info - Infallible conversion to
SocketInfo
. - Matcher
- A matcher for results expected from a milter.
Functions§
- any
- Returns a matcher that accepts any input.
Type Aliases§
- Test
Result - A result type specialised for test errors.
- Version
- The type of the milter protocol version.