\doxysection{Milter.\+test.\+Test\+Base Class Reference}
\label{classMilter_1_1test_1_1TestBase}\index{Milter.test.TestBase@{Milter.test.TestBase}}


Test mixin for unit testing milter applications.  


Inheritance diagram for Milter.\+test.\+Test\+Base\+:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2.000000cm]{classMilter_1_1test_1_1TestBase}
\end{center}
\end{figure}
\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{classMilter_1_1test_1_1TestBase_ac6ba6d3a2c391705307bf6e324f5bdd1}} 
def {\bfseries \+\_\+\+\_\+init\+\_\+\+\_\+} (self, logfile=\textquotesingle{}test/milter.\+log\textquotesingle{})
\item 
\mbox{\label{classMilter_1_1test_1_1TestBase_ae252ff9e7f4494c4ca9de3ba083cf1dc}} 
def {\bfseries log} (self, $\ast$msg)
\item 
def \textbf{ setsymval} (self, name, val)
\begin{DoxyCompactList}\small\item\em Set a macro value. \end{DoxyCompactList}\item 
\mbox{\label{classMilter_1_1test_1_1TestBase_acf18850f87fb2daff6381f784f488fac}} 
def {\bfseries getsymval} (self, name)
\item 
\mbox{\label{classMilter_1_1test_1_1TestBase_a6c07c93eece38b0d80b3aeb67aef65b5}} 
def {\bfseries replacebody} (self, chunk)
\item 
\mbox{\label{classMilter_1_1test_1_1TestBase_a0a4ebf0d743e5fe9692d7296e60196ef}} 
def {\bfseries chgfrom} (self, sender, params=None)
\item 
\mbox{\label{classMilter_1_1test_1_1TestBase_a90a990fb32486a7fe4cf5289dfe87bce}} 
def {\bfseries quarantine} (self, reason)
\item 
\mbox{\label{classMilter_1_1test_1_1TestBase_ad279fc5a059f4648d0e0ca982e30e6e4}} 
def {\bfseries progress} (self)
\item 
\mbox{\label{classMilter_1_1test_1_1TestBase_ad36239878e83cd8c0d612d7e184d5bea}} 
def {\bfseries chgheader} (self, field, idx, value)
\item 
\mbox{\label{classMilter_1_1test_1_1TestBase_ae4c1837aa8cf6d22e6e9869bd97f8eaa}} 
def {\bfseries addheader} (self, field, value, idx=-\/1)
\item 
\mbox{\label{classMilter_1_1test_1_1TestBase_ae5064d55c6f262cc02f6f1ab667b59bb}} 
def {\bfseries delrcpt} (self, rcpt)
\item 
\mbox{\label{classMilter_1_1test_1_1TestBase_af01f8f7f8bda4b9b9bce23f322fc0d01}} 
def {\bfseries addrcpt} (self, rcpt)
\item 
\mbox{\label{classMilter_1_1test_1_1TestBase_a55f4cf3e726d86400e1656161a03fd7d}} 
def \textbf{ setreply} (self, rcode, xcode, $\ast$msg)
\begin{DoxyCompactList}\small\item\em Save the reply codes and messages in self.\+\_\+reply. \end{DoxyCompactList}\item 
\mbox{\label{classMilter_1_1test_1_1TestBase_a8790e6299f05cff3523cbc1feaacee3d}} 
def {\bfseries setsymlist} (self, stage, macros)
\item 
def \textbf{ feed\+File} (self, fp, sender=\char`\"{}spam@adv.\+com\char`\"{}, rcpt=\char`\"{}victim@lamb.\+com\char`\"{}, $\ast$rcpts)
\begin{DoxyCompactList}\small\item\em Feed a file like object to the milter. \end{DoxyCompactList}\item 
def \textbf{ feed\+Msg} (self, fname, sender=\char`\"{}spam@adv.\+com\char`\"{}, $\ast$rcpts)
\begin{DoxyCompactList}\small\item\em Feed an email contained in a file to the milter. \end{DoxyCompactList}\item 
def \textbf{ connect} (self, host=\textquotesingle{}localhost\textquotesingle{}, helo=\textquotesingle{}spamrelay\textquotesingle{}, ip=\textquotesingle{}1.\+2.\+3.\+4\textquotesingle{})
\begin{DoxyCompactList}\small\item\em Call the connect and helo callbacks. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Public Attributes}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{classMilter_1_1test_1_1TestBase_ae576a5c9292c902cacf776706b51ee83}} 
{\bfseries logfp}
\end{DoxyCompactItemize}
\doxysubsection*{Private Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{classMilter_1_1test_1_1TestBase_af6e985c05e22e77541bc163965e1a7b2}} 
def {\bfseries \+\_\+close} (self)
\end{DoxyCompactItemize}
\doxysubsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{classMilter_1_1test_1_1TestBase_a554495134126b4604d7ec563bfdf3d10}} 
{\bfseries \+\_\+protocol}
\item 
\mbox{\label{classMilter_1_1test_1_1TestBase_af5360296975c1f44fcb6c8ea1d3bebff}} 
\textbf{ \+\_\+sender}
\begin{DoxyCompactList}\small\item\em The MAIL FROM for the current email being fed to the milter. \end{DoxyCompactList}\item 
\mbox{\label{classMilter_1_1test_1_1TestBase_ad72eb23389fe68f0bc0c8b88b1338c32}} 
\textbf{ \+\_\+delrcpt}
\begin{DoxyCompactList}\small\item\em List of recipients deleted. \end{DoxyCompactList}\item 
\mbox{\label{classMilter_1_1test_1_1TestBase_a36b1103fa4973f2aeb4628333b094d3c}} 
\textbf{ \+\_\+addrcpt}
\begin{DoxyCompactList}\small\item\em List of recipients added. \end{DoxyCompactList}\item 
\mbox{\label{classMilter_1_1test_1_1TestBase_a3650cd21768a663a737e8640df2d5e96}} 
\textbf{ \+\_\+macros}
\begin{DoxyCompactList}\small\item\em Macros defined. \end{DoxyCompactList}\item 
\mbox{\label{classMilter_1_1test_1_1TestBase_a91f2c2958adb1b070219caed7a4a3bec}} 
\textbf{ \+\_\+body}
\begin{DoxyCompactList}\small\item\em The message body. \end{DoxyCompactList}\item 
\mbox{\label{classMilter_1_1test_1_1TestBase_a26c23edb207941eafc4047322c29baa2}} 
\textbf{ \+\_\+bodyreplaced}
\begin{DoxyCompactList}\small\item\em True if the milter replaced the message body. \end{DoxyCompactList}\item 
\mbox{\label{classMilter_1_1test_1_1TestBase_a7ec00842c93705982e451d6e1b0a4cd4}} 
\textbf{ \+\_\+headerschanged}
\begin{DoxyCompactList}\small\item\em True if the milter changed any headers. \end{DoxyCompactList}\item 
\mbox{\label{classMilter_1_1test_1_1TestBase_a4a44923db5a3fda8087df623839aca30}} 
\textbf{ \+\_\+envfromchanged}
\begin{DoxyCompactList}\small\item\em True if the milter changed the envelope from. \end{DoxyCompactList}\item 
\mbox{\label{classMilter_1_1test_1_1TestBase_a6a00a684cc746f4c5d00bab5a6cfa89f}} 
\textbf{ \+\_\+reply}
\begin{DoxyCompactList}\small\item\em Reply codes and messages set by the milter. \end{DoxyCompactList}\item 
\mbox{\label{classMilter_1_1test_1_1TestBase_a197497e481c38a59a313a55d8dc6f280}} 
\textbf{ \+\_\+msg}
\begin{DoxyCompactList}\small\item\em The rfc822 message object for the current email being fed to the milter. \end{DoxyCompactList}\item 
\mbox{\label{classMilter_1_1test_1_1TestBase_ac0ad0e961bd45af111a57977882bc2f4}} 
\textbf{ \+\_\+stage}
\begin{DoxyCompactList}\small\item\em The protocol stage for macros returned. \end{DoxyCompactList}\item 
\mbox{\label{classMilter_1_1test_1_1TestBase_aa8452abd02ee8cf5dfcf4b3d9daa697e}} 
\textbf{ \+\_\+symlist}
\begin{DoxyCompactList}\small\item\em The macros returned by protocol stage. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Test mixin for unit testing milter applications. 

This mixin overrides many Milter.\+Milter\+Base methods with stub versions that simply record what was done. \begin{DoxyRefDesc}{Deprecated}
\item[\textbf{ Deprecated}]Use Milter.\+test.\+Test\+Ctx \end{DoxyRefDesc}
\begin{DoxySince}{Since}
0.\+9.\+8 
\end{DoxySince}


\doxysubsection{Member Function Documentation}
\mbox{\label{classMilter_1_1test_1_1TestBase_ac4848e3d1e4af76c8bf6d7a7e9c36113}} 
\index{Milter.test.TestBase@{Milter.test.TestBase}!connect@{connect}}
\index{connect@{connect}!Milter.test.TestBase@{Milter.test.TestBase}}
\doxysubsubsection{connect()}
{\footnotesize\ttfamily def Milter.\+test.\+Test\+Base.\+connect (\begin{DoxyParamCaption}\item[{}]{self,  }\item[{}]{host = {\ttfamily \textquotesingle{}localhost\textquotesingle{}},  }\item[{}]{helo = {\ttfamily \textquotesingle{}spamrelay\textquotesingle{}},  }\item[{}]{ip = {\ttfamily \textquotesingle{}1.2.3.4\textquotesingle{}} }\end{DoxyParamCaption})}



Call the connect and helo callbacks. 

The helo callback is not called if connect does not return CONTINUE. 
\begin{DoxyParams}{Parameters}
{\em host} & the hostname passed to the connect callback \\
\hline
{\em helo} & the hostname passed to the helo callback \\
\hline
{\em ip} & the IP address passed to the connect callback \\
\hline
\end{DoxyParams}


References Milter.\+test.\+Test\+Base.\+\_\+body, Milter.\+testctx.\+Test\+Ctx.\+\_\+body, Milter.\+test.\+Test\+Base.\+\_\+bodyreplaced, Milter.\+testctx.\+Test\+Ctx.\+\_\+bodyreplaced, Milter.\+Base.\+\_\+setctx(), Milter.\+test.\+Test\+Base.\+\_\+stage, Milter.\+testctx.\+Test\+Ctx.\+\_\+stage, Milter.\+Base.\+close(), Milter.\+Milter.\+close(), Milter.\+greylist.\+Greylist.\+close(), Milter.\+greysql.\+Greylist.\+close(), Milter.\+policy.\+DB.\+close(), Milter.\+policy.\+MTAPolicy.\+close(), Milter.\+sgmllib.\+SGMLParser.\+close(), Milter.\+sgmllib.\+Test\+SGMLParser.\+close(), Milter.\+Base.\+hello(), Milter.\+Milter.\+hello(), and Milter.\+Base.\+negotiate().

\mbox{\label{classMilter_1_1test_1_1TestBase_a0244bf36ae5d55bad2d27a0c533c2dff}} 
\index{Milter.test.TestBase@{Milter.test.TestBase}!feedFile@{feedFile}}
\index{feedFile@{feedFile}!Milter.test.TestBase@{Milter.test.TestBase}}
\doxysubsubsection{feedFile()}
{\footnotesize\ttfamily def Milter.\+test.\+Test\+Base.\+feed\+File (\begin{DoxyParamCaption}\item[{}]{self,  }\item[{}]{fp,  }\item[{}]{sender = {\ttfamily \char`\"{}spam@adv.com\char`\"{}},  }\item[{}]{rcpt = {\ttfamily \char`\"{}victim@lamb.com\char`\"{}},  }\item[{$\ast$}]{rcpts }\end{DoxyParamCaption})}



Feed a file like object to the milter. 

Calls envfrom, envrcpt for each recipient, header for each header field, body for each body block, and finally eom. A return code from the milter other than CONTINUE returns immediately with that return code.

This is a convenience method, a test could invoke the callbacks in sequence on its own -\/ and for some complex tests, this may be necessary. 
\begin{DoxyParams}{Parameters}
{\em fp} & the file with rfc2822 message stream \\
\hline
{\em sender} & the MAIL FROM \\
\hline
{\em rcpt} & RCPT TO -\/ additional recipients may follow \\
\hline
\end{DoxyParams}


References Milter.\+test.\+Test\+Base.\+\_\+body, Milter.\+testctx.\+Test\+Ctx.\+\_\+body, Milter.\+test.\+Test\+Base.\+\_\+bodyreplaced, Milter.\+testctx.\+Test\+Ctx.\+\_\+bodyreplaced, Milter.\+test.\+Test\+Base.\+\_\+close(), Milter.\+testctx.\+Test\+Ctx.\+\_\+close(), Milter.\+test.\+Test\+Base.\+\_\+headerschanged, Milter.\+testctx.\+Test\+Ctx.\+\_\+headerschanged, Milter.\+test.\+Test\+Base.\+\_\+msg, Milter.\+testctx.\+Test\+Ctx.\+\_\+msg, Milter.\+test.\+Test\+Base.\+\_\+reply, Milter.\+testctx.\+Test\+Ctx.\+\_\+reply, Milter.\+test.\+Test\+Base.\+\_\+sender, Milter.\+testctx.\+Test\+Ctx.\+\_\+sender, Milter.\+test.\+Test\+Base.\+\_\+stage, Milter.\+testctx.\+Test\+Ctx.\+\_\+stage, Milter.\+Base.\+body(), Milter.\+Base.\+close(), Milter.\+Milter.\+close(), Milter.\+greylist.\+Greylist.\+close(), Milter.\+greysql.\+Greylist.\+close(), Milter.\+policy.\+DB.\+close(), Milter.\+policy.\+MTAPolicy.\+close(), Milter.\+sgmllib.\+SGMLParser.\+close(), Milter.\+sgmllib.\+Test\+SGMLParser.\+close(), Milter.\+Base.\+data(), Milter.\+Base.\+envfrom(), Milter.\+Milter.\+envfrom(), Milter.\+Base.\+envrcpt(), Milter.\+Milter.\+envrcpt(), Milter.\+Base.\+eoh(), Milter.\+Milter.\+eoh(), Milter.\+Base.\+eom(), Milter.\+Milter.\+eom(), and Milter.\+Base.\+header\+\_\+bytes.



Referenced by Milter.\+test.\+Test\+Base.\+feed\+Msg().

\mbox{\label{classMilter_1_1test_1_1TestBase_a36ce3c09a9d2ea939a70e001b86e44a3}} 
\index{Milter.test.TestBase@{Milter.test.TestBase}!feedMsg@{feedMsg}}
\index{feedMsg@{feedMsg}!Milter.test.TestBase@{Milter.test.TestBase}}
\doxysubsubsection{feedMsg()}
{\footnotesize\ttfamily def Milter.\+test.\+Test\+Base.\+feed\+Msg (\begin{DoxyParamCaption}\item[{}]{self,  }\item[{}]{fname,  }\item[{}]{sender = {\ttfamily \char`\"{}spam@adv.com\char`\"{}},  }\item[{$\ast$}]{rcpts }\end{DoxyParamCaption})}



Feed an email contained in a file to the milter. 

This is a convenience method that invokes \doxyref{feed\+File }{p.}{classMilter_1_1test_1_1TestBase_a0244bf36ae5d55bad2d27a0c533c2dff}. 
\begin{DoxyParams}{Parameters}
{\em sender} & MAIL FROM \\
\hline
{\em rcpts} & RCPT TO, multiple recipients may be supplied \\
\hline
\end{DoxyParams}


References Milter.\+test.\+Test\+Base.\+feed\+File().

\mbox{\label{classMilter_1_1test_1_1TestBase_a2b863aee79cab3a421460ce18bc34ada}} 
\index{Milter.test.TestBase@{Milter.test.TestBase}!setsymval@{setsymval}}
\index{setsymval@{setsymval}!Milter.test.TestBase@{Milter.test.TestBase}}
\doxysubsubsection{setsymval()}
{\footnotesize\ttfamily def Milter.\+test.\+Test\+Base.\+setsymval (\begin{DoxyParamCaption}\item[{}]{self,  }\item[{}]{name,  }\item[{}]{val }\end{DoxyParamCaption})}



Set a macro value. 

These are retrieved by the milter with getsymval. 
\begin{DoxyParams}{Parameters}
{\em name} & the macro name, as passed to getsymval \\
\hline
{\em val} & the macro value \\
\hline
\end{DoxyParams}


References Milter.\+test.\+Test\+Base.\+\_\+body, Milter.\+testctx.\+Test\+Ctx.\+\_\+body, Milter.\+test.\+Test\+Base.\+\_\+bodyreplaced, Milter.\+testctx.\+Test\+Ctx.\+\_\+bodyreplaced, Milter.\+test.\+Test\+Base.\+\_\+envfromchanged, Milter.\+testctx.\+Test\+Ctx.\+\_\+envfromchanged, Milter.\+test.\+Test\+Base.\+\_\+macros, Milter.\+testctx.\+Test\+Ctx.\+\_\+macros, Milter.\+test.\+Test\+Base.\+\_\+sender, Milter.\+testctx.\+Test\+Ctx.\+\_\+sender, Milter.\+test.\+Test\+Base.\+\_\+stage, Milter.\+testctx.\+Test\+Ctx.\+\_\+stage, Milter.\+test.\+Test\+Base.\+\_\+symlist, Milter.\+testctx.\+Test\+Ctx.\+\_\+symlist, Milter.\+Base.\+log(), Milter.\+Milter.\+log(), and Milter.\+test.\+Test\+Base.\+log().



The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
Milter/test.\+py\end{DoxyCompactItemize}
