This module provides helpers for writing expect tests for testing
Async_smtp and Async_smtp.Server plugins.
type 'a server_flags = ?max_message_size:Core.Byte_units.t ‑> ?malformed_emails:[ `Reject | `Wrap ] ‑> ?echo_delivery:bool ‑> ?server_log:[ Async.Log.Level.t | `None ] ‑> ?plugin:(module Async_smtp__.Server.Plugin.S) ‑> ?plugin_log:[ Async.Log.Level.t | `None ] ‑> 'atype 'a client_flags = ?credentials:Async_smtp__.Credentials.t ‑> ?client_greeting:string ‑> ?client_log:[ Async.Log.Level.t | `None ] ‑> 'aval envelope : ?sender:string ‑> ?recipients:string list ‑> ?data:string ‑> unit ‑> Async_smtp_types.Smtp_envelope.tHelper for creating SMTP Envelopes
val smtp : (Async_smtp_types.Smtp_envelope.t list ‑> unit Async.Deferred.t) client_flags server_flags smtp_flagsAttempt to send the given envelope to a dummy server. Expect test output will be the SMTP session transcript with the following format: < EHLO Client > 200 Server Response Custom plugin output
val manual_client : ((client:(string ‑> unit Async.Deferred.t) ‑> server:(string ‑> unit Async.Deferred.t) ‑> unit Async.Deferred.t) ‑> unit Async.Deferred.t) server_flags smtp_flagsLike smtp but instead of the mailcore client you describe the client behaviour
allowing testing server behaviour in edge cases.
Use client to submit requests to the server, and server to document the expected
responses.
Example
manual_client
(fun ~client ~server ->
server "220 [SMTP TEST SERVER]"
>>= fun () ->
client "EHLO test"
>>= fun () ->
server "250-Ok: Continue, extensions follow:\n\
250 8BITMIME"
>>= fun () ->
client "RESET"
>>= fun () ->
server "250 Ok: continue"
>>= fun () ->
client "QUIT"
>>= fun () ->
server "221 closing connection"
)val manual_server : (Async_smtp_types.Smtp_envelope.t list ‑> (client:(string ‑> unit Async.Deferred.t) ‑> server:(string ‑> unit Async.Deferred.t) ‑> unit Async.Deferred.t) ‑> unit Async.Deferred.t) client_flags smtp_flagsLike manual_client but you provide the server side of the protocol.
Use client to document expected requests, and server to send the responses.