bonzo.testing – Unit testing support for asynchronous code¶
Unit testing support for asynchronous code.
- class bonzo.testing.AsyncSMTPTestCase(methodName: str = 'runTest')[source]¶
Bases:
AsyncTestCaseA test case that starts up an SMTP server.
Subclasses must override
get_request_callback(), which returns aSMTPServercallback to be tested.- connect(read_response=True)[source]¶
Creates a instance of
IOStreamfor reading and writing bytes to the opened socket on the SMTP server address.- Parameters:
read_response (bool) – Reads the response of the server immediately after to establish connection. Useful to read the response and discard the welcome message.
- get_request_callback()[source]¶
Should be overridden by subclasses to return a
SMTPServercallback.
- get_smtp_server()[source]¶
Returns an instance of
SMTPServerthat will be used in the test case. It’s inmediatelly called when theAsyncSMTPTestCaseis instanced.
- get_smtpserver_options()[source]¶
May be overridden by subclasses to return additional keyword arguments for the server.