|
pymilter
1.0.2
|
Milter context for unit testing milter applications. More...
Public Member Functions | |
| def | __init__ (self, logfile='test/milter.log') |
| def | getpriv (self) |
| def | setpriv (self, priv) |
| def | getsymval (self, name) |
| def | setreply (self, rcode, xcode, msg) |
| def | setsymlist (self, stage, macros) |
| def | addheader (self, field, value, idx) |
| def | chgheader (self, field, idx, value) |
| def | addrcpt (self, rcpt, params) |
| def | delrcpt (self, rcpt) |
| def | replacebody (self, chunk) |
| def | chgfrom (self, sender, params=None) |
| def | quarantine (self, reason) |
| def | progress (self) |
| Reset activity timer. More... | |
Static Public Attributes | |
| list | default_opts = [Milter.CURR_ACTS,0x1fffff,0,0] |
Private Member Functions | |
| def | _setsymval (self, name, val) |
| def | _abort (self) |
| def | _close (self) |
| def | _negotiate (self) |
| def | _connect (self, host='localhost', helo='spamrelay', ip='1.2.3.4') |
| def | _helo (self, helo) |
| def | _envfrom (self, s) |
| def | _envrcpt (self, s) |
| def | _data (self) |
| def | _header (self, fld, val) |
| def | _eoh (self) |
| def | _feed_body (self, bfp) |
| def | _eom (self) |
| def | _feedFile (self, fp, sender="spam@adv.com", rcpt="victim@lamb.com", rcpts) |
| Feed a file like object to the ctx. More... | |
| def | _feedMsg (self, fname, sender="spam@adv.com", rcpts) |
| Feed an email contained in a file to the milter. More... | |
Private Attributes | |
| _priv | |
| Usually the Milter application derived from Milter.Base. | |
| _delrcpt | |
| List of recipients deleted. | |
| _addrcpt | |
| List of recipients added. | |
| _macros | |
| Macros defined. | |
| _reply | |
| Reply codes and messages set by the milter. | |
| _symlist | |
| The macros returned by protocol stage. | |
| _body | |
| The message body. More... | |
| _bodyreplaced | |
| True if the milter replaced the message body. More... | |
| _headerschanged | |
| True if the milter changed any headers. More... | |
| _msg | |
| The rfc822 message object for the current email being fed to the milter. More... | |
| _sender | |
| The MAIL FROM for the current email being fed to the milter. | |
| _envfromchanged | |
| True if the milter changed the envelope from. More... | |
| _opts | |
| Negotiated options. | |
| _activity | |
| Last activity. | |
| _stage | |
| _protocol | |
Milter context for unit testing milter applications.
A substitute for milter.milterContext that can be passed to Milter.Base._setctx().
|
private |
Feed a file like object to the ctx.
Calls the callbacks in the same sequence as libmilter.
| fp | the file with rfc2822 message stream |
| sender | the MAIL FROM |
| rcpt | RCPT TO - additional recipients may follow |
References Milter.test.TestBase._body, Milter.testctx.TestCtx._body, Milter.test.TestBase._bodyreplaced, Milter.testctx.TestCtx._bodyreplaced, Milter.testctx.TestCtx._data(), Milter.testctx.TestCtx._envfrom(), Milter.testctx.TestCtx._envrcpt(), Milter.testctx.TestCtx._eoh(), Milter.testctx.TestCtx._eom(), Milter.testctx.TestCtx._feed_body(), Milter.testctx.TestCtx._header(), Milter.test.TestBase._headerschanged, Milter.testctx.TestCtx._headerschanged, Milter.test.TestBase._msg, Milter.testctx.TestCtx._msg, Milter.testctx.TestCtx._reply, and Milter.test.TestBase._reply.
Referenced by Milter.testctx.TestCtx._feedMsg().
|
private |
Feed an email contained in a file to the milter.
This is a convenience method that invokes feedFile .
| sender | MAIL FROM |
| rcpts | RCPT TO, multiple recipients may be supplied |
References Milter.testctx.TestCtx._feedFile().
| def Milter.testctx.TestCtx.progress | ( | self | ) |
Reset activity timer.
References Milter.testctx.TestCtx._abort(), Milter.testctx.TestCtx._activity, Milter.test.TestBase._body, Milter.testctx.TestCtx._body, Milter.test.TestBase._bodyreplaced, Milter.testctx.TestCtx._bodyreplaced, Milter.testctx.TestCtx._close(), Milter.testctx.TestCtx._helo(), Milter.testctx.TestCtx._negotiate(), Milter.testctx.TestCtx._opts, Milter.testctx.TestCtx._priv, Milter.test.TestBase._protocol, Milter.testctx.TestCtx._protocol, Milter.Base._protocol, Milter.test.TestBase._sender, Milter.testctx.TestCtx._sender, Milter.test.TestBase._stage, Milter.testctx.TestCtx._stage, Milter.close_callback(), Milter.connect_callback(), and Milter.negotiate_callback().
|
private |
The message body.
Referenced by Milter.testctx.TestCtx._feedFile(), and Milter.testctx.TestCtx.progress().
|
private |
True if the milter replaced the message body.
Referenced by Milter.testctx.TestCtx._feedFile(), and Milter.testctx.TestCtx.progress().
|
private |
True if the milter changed the envelope from.
|
private |
True if the milter changed any headers.
Referenced by Milter.testctx.TestCtx._feedFile().
|
private |
The rfc822 message object for the current email being fed to the milter.
Referenced by Milter.testctx.TestCtx._feedFile().
1.8.13