\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}
\doxysubsubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\label{classMilter_1_1test_1_1TestBase_a946d4ce73229638bc503c66041a7af5e} 
{\bfseries \+\_\+\+\_\+init\+\_\+\+\_\+} (self, logfile=\textquotesingle{}test/milter.\+log\textquotesingle{})
\item 
\label{classMilter_1_1test_1_1TestBase_a3fcea10927e3d0d91ccff0f63e641bbd} 
{\bfseries log} (self, $\ast$msg)
\item 
\textbf{ setsymval} (self, name, val)
\begin{DoxyCompactList}\small\item\em Set a macro value. \end{DoxyCompactList}\item 
\label{classMilter_1_1test_1_1TestBase_a3fa3db328c077678d1b89b5d3350d752} 
{\bfseries getsymval} (self, name)
\item 
\label{classMilter_1_1test_1_1TestBase_abc8dd6b1aba6b2d441726f3a8b0c7a0f} 
{\bfseries replacebody} (self, chunk)
\item 
\label{classMilter_1_1test_1_1TestBase_a21e78957f5dcdbde2721aa8488a6fe7e} 
{\bfseries chgfrom} (self, sender, params=None)
\item 
\label{classMilter_1_1test_1_1TestBase_ac459835e1f5a7103accb7379836aaf76} 
{\bfseries quarantine} (self, reason)
\item 
\label{classMilter_1_1test_1_1TestBase_a3da500f02c06e443a0d6c998e4a8df16} 
{\bfseries progress} (self)
\item 
\label{classMilter_1_1test_1_1TestBase_adc6913c27c233c97ca9ea0519770b477} 
{\bfseries chgheader} (self, field, idx, value)
\item 
\label{classMilter_1_1test_1_1TestBase_a32dd6da74800d279b9eaacf2d393af76} 
{\bfseries addheader} (self, field, value, idx=-\/1)
\item 
\label{classMilter_1_1test_1_1TestBase_adfe6d7ca803d2de0bf5c652308d65ae3} 
{\bfseries delrcpt} (self, rcpt)
\item 
\label{classMilter_1_1test_1_1TestBase_ab192a5eca7596a864aa699cc01974dba} 
{\bfseries addrcpt} (self, rcpt)
\item 
\label{classMilter_1_1test_1_1TestBase_a26b736cfb943c90184615864b7ccbd65} 
{\bfseries setreply} (self, rcode, xcode, $\ast$msg)
\begin{DoxyCompactList}\small\item\em Save the reply codes and messages in self.\+\_\+reply. \end{DoxyCompactList}\item 
\label{classMilter_1_1test_1_1TestBase_af7d3bce3655d1a8070e9147698e61e28} 
{\bfseries setsymlist} (self, stage, macros)
\item 
\textbf{ feed\+File} (self, fp, sender="{}spam@adv.\+com"{}, rcpt="{}victim@lamb.\+com"{}, $\ast$rcpts)
\begin{DoxyCompactList}\small\item\em Feed a file like object to the milter. \end{DoxyCompactList}\item 
\textbf{ feed\+Msg} (self, fname, sender="{}spam@adv.\+com"{}, $\ast$rcpts)
\begin{DoxyCompactList}\small\item\em Feed an email contained in a file to the milter. \end{DoxyCompactList}\item 
\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}
\doxysubsubsection*{Public Attributes}
\begin{DoxyCompactItemize}
\item 
\label{classMilter_1_1test_1_1TestBase_ae576a5c9292c902cacf776706b51ee83} 
{\bfseries logfp}
\end{DoxyCompactItemize}
\doxysubsubsection*{Protected Member Functions}
\begin{DoxyCompactItemize}
\item 
\label{classMilter_1_1test_1_1TestBase_add58719ccfc8d1513629e7c0e36c9ee5} 
{\bfseries \+\_\+close} (self)
\end{DoxyCompactItemize}
\doxysubsubsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
\label{classMilter_1_1test_1_1TestBase_a554495134126b4604d7ec563bfdf3d10} 
{\bfseries \+\_\+protocol}
\item 
\label{classMilter_1_1test_1_1TestBase_af5360296975c1f44fcb6c8ea1d3bebff} 
{\bfseries \+\_\+sender}
\begin{DoxyCompactList}\small\item\em The MAIL FROM for the current email being fed to the milter. \end{DoxyCompactList}\item 
\label{classMilter_1_1test_1_1TestBase_ad72eb23389fe68f0bc0c8b88b1338c32} 
{\bfseries \+\_\+delrcpt}
\begin{DoxyCompactList}\small\item\em List of recipients deleted. \end{DoxyCompactList}\item 
\label{classMilter_1_1test_1_1TestBase_a36b1103fa4973f2aeb4628333b094d3c} 
{\bfseries \+\_\+addrcpt}
\begin{DoxyCompactList}\small\item\em List of recipients added. \end{DoxyCompactList}\item 
\label{classMilter_1_1test_1_1TestBase_a3650cd21768a663a737e8640df2d5e96} 
{\bfseries \+\_\+macros}
\begin{DoxyCompactList}\small\item\em Macros defined. \end{DoxyCompactList}\item 
\label{classMilter_1_1test_1_1TestBase_a91f2c2958adb1b070219caed7a4a3bec} 
{\bfseries \+\_\+body}
\begin{DoxyCompactList}\small\item\em The message body. \end{DoxyCompactList}\item 
\label{classMilter_1_1test_1_1TestBase_a26c23edb207941eafc4047322c29baa2} 
{\bfseries \+\_\+bodyreplaced}
\begin{DoxyCompactList}\small\item\em True if the milter replaced the message body. \end{DoxyCompactList}\item 
\label{classMilter_1_1test_1_1TestBase_a7ec00842c93705982e451d6e1b0a4cd4} 
{\bfseries \+\_\+headerschanged}
\begin{DoxyCompactList}\small\item\em True if the milter changed any headers. \end{DoxyCompactList}\item 
\label{classMilter_1_1test_1_1TestBase_a4a44923db5a3fda8087df623839aca30} 
{\bfseries \+\_\+envfromchanged}
\begin{DoxyCompactList}\small\item\em True if the milter changed the envelope from. \end{DoxyCompactList}\item 
\label{classMilter_1_1test_1_1TestBase_a6a00a684cc746f4c5d00bab5a6cfa89f} 
{\bfseries \+\_\+reply}
\begin{DoxyCompactList}\small\item\em Reply codes and messages set by the milter. \end{DoxyCompactList}\item 
\label{classMilter_1_1test_1_1TestBase_a197497e481c38a59a313a55d8dc6f280} 
{\bfseries \+\_\+msg}
\begin{DoxyCompactList}\small\item\em The rfc822 message object for the current email being fed to the milter. \end{DoxyCompactList}\item 
\label{classMilter_1_1test_1_1TestBase_ac0ad0e961bd45af111a57977882bc2f4} 
{\bfseries \+\_\+stage}
\begin{DoxyCompactList}\small\item\em The protocol stage for macros returned. \end{DoxyCompactList}\item 
\label{classMilter_1_1test_1_1TestBase_aa8452abd02ee8cf5dfcf4b3d9daa697e} 
{\bfseries \+\_\+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}
\label{classMilter_1_1test_1_1TestBase_aac23431e6bc8ff54e92fca55a8914aa4} 
\index{Milter.test.TestBase@{Milter.test.TestBase}!connect@{connect}}
\index{connect@{connect}!Milter.test.TestBase@{Milter.test.TestBase}}
\doxysubsubsection{connect()}
{\footnotesize\ttfamily 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 \textbf{ Milter.\+test.\+Test\+Base.\+\_\+body}, \textbf{ Milter.\+testctx.\+Test\+Ctx.\+\_\+body}, \textbf{ Milter.\+test.\+Test\+Base.\+\_\+bodyreplaced}, \textbf{ Milter.\+testctx.\+Test\+Ctx.\+\_\+bodyreplaced}, \textbf{ Milter.\+Base.\+\_\+setctx()}, \textbf{ Milter.\+test.\+Test\+Base.\+\_\+stage}, Milter.\+testctx.\+Test\+Ctx.\+\_\+stage, \textbf{ Milter.\+Base.\+close()}, \textbf{ Milter.\+Milter.\+close()}, Milter.\+greylist.\+Greylist.\+close(), Milter.\+greysql.\+Greylist.\+close(), Milter.\+policy.\+DB.\+close(), Milter.\+policy.\+MTAPolicy.\+close(), \textbf{ Milter.\+sgmllib.\+SGMLParser.\+close()}, \textbf{ Milter.\+sgmllib.\+Test\+SGMLParser.\+close()}, \textbf{ Milter.\+test.\+Test\+Base.\+connect()}, \textbf{ Milter.\+Base.\+hello()}, \textbf{ Milter.\+Milter.\+hello()}, and \textbf{ Milter.\+Base.\+negotiate()}.



Referenced by \textbf{ Milter.\+test.\+Test\+Base.\+connect()}.

\label{classMilter_1_1test_1_1TestBase_ab8928a260a93a021668f9cbf70640526} 
\index{Milter.test.TestBase@{Milter.test.TestBase}!feedFile@{feedFile}}
\index{feedFile@{feedFile}!Milter.test.TestBase@{Milter.test.TestBase}}
\doxysubsubsection{feedFile()}
{\footnotesize\ttfamily Milter.\+test.\+Test\+Base.\+feed\+File (\begin{DoxyParamCaption}\item[{}]{self,  }\item[{}]{fp,  }\item[{}]{sender = {\ttfamily "{}spam@adv.com"{}},  }\item[{}]{rcpt = {\ttfamily "{}victim@lamb.com"{}},  }\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 \textbf{ Milter.\+test.\+Test\+Base.\+\_\+body}, \textbf{ Milter.\+testctx.\+Test\+Ctx.\+\_\+body}, \textbf{ Milter.\+test.\+Test\+Base.\+\_\+bodyreplaced}, \textbf{ Milter.\+testctx.\+Test\+Ctx.\+\_\+bodyreplaced}, Milter.\+test.\+Test\+Base.\+\_\+close(), Milter.\+testctx.\+Test\+Ctx.\+\_\+close(), \textbf{ Milter.\+test.\+Test\+Base.\+\_\+headerschanged}, \textbf{ Milter.\+testctx.\+Test\+Ctx.\+\_\+headerschanged}, \textbf{ Milter.\+test.\+Test\+Base.\+\_\+msg}, \textbf{ Milter.\+testctx.\+Test\+Ctx.\+\_\+msg}, \textbf{ Milter.\+test.\+Test\+Base.\+\_\+reply}, \textbf{ Milter.\+testctx.\+Test\+Ctx.\+\_\+reply}, \textbf{ Milter.\+test.\+Test\+Base.\+\_\+sender}, \textbf{ Milter.\+testctx.\+Test\+Ctx.\+\_\+sender}, \textbf{ Milter.\+test.\+Test\+Base.\+\_\+stage}, Milter.\+testctx.\+Test\+Ctx.\+\_\+stage, \textbf{ Milter.\+Base.\+body()}, \textbf{ Milter.\+Base.\+close()}, \textbf{ Milter.\+Milter.\+close()}, Milter.\+greylist.\+Greylist.\+close(), Milter.\+greysql.\+Greylist.\+close(), Milter.\+policy.\+DB.\+close(), Milter.\+policy.\+MTAPolicy.\+close(), \textbf{ Milter.\+sgmllib.\+SGMLParser.\+close()}, \textbf{ Milter.\+sgmllib.\+Test\+SGMLParser.\+close()}, \textbf{ Milter.\+Base.\+data()}, \textbf{ Milter.\+Base.\+envfrom()}, \textbf{ Milter.\+Milter.\+envfrom()}, \textbf{ Milter.\+Base.\+envrcpt()}, \textbf{ Milter.\+Milter.\+envrcpt()}, \textbf{ Milter.\+Base.\+eoh()}, \textbf{ Milter.\+Milter.\+eoh()}, \textbf{ Milter.\+Base.\+eom()}, \textbf{ Milter.\+Milter.\+eom()}, \textbf{ Milter.\+Base.\+header\+\_\+bytes()}, and Milter.\+Base.\+header\+\_\+bytes.



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

\label{classMilter_1_1test_1_1TestBase_a6923a00079eb6114a2825c4ea47e1d13} 
\index{Milter.test.TestBase@{Milter.test.TestBase}!feedMsg@{feedMsg}}
\index{feedMsg@{feedMsg}!Milter.test.TestBase@{Milter.test.TestBase}}
\doxysubsubsection{feedMsg()}
{\footnotesize\ttfamily Milter.\+test.\+Test\+Base.\+feed\+Msg (\begin{DoxyParamCaption}\item[{}]{self,  }\item[{}]{fname,  }\item[{}]{sender = {\ttfamily "{}spam@adv.com"{}},  }\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.}{}. 
\begin{DoxyParams}{Parameters}
{\em sender} & MAIL FROM \\
\hline
{\em rcpts} & RCPT TO, multiple recipients may be supplied \\
\hline
\end{DoxyParams}


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

\label{classMilter_1_1test_1_1TestBase_a15f2a8c7c08af2f29ef291ebc2f6ff5f} 
\index{Milter.test.TestBase@{Milter.test.TestBase}!setsymval@{setsymval}}
\index{setsymval@{setsymval}!Milter.test.TestBase@{Milter.test.TestBase}}
\doxysubsubsection{setsymval()}
{\footnotesize\ttfamily 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 \textbf{ Milter.\+test.\+Test\+Base.\+\_\+body}, \textbf{ Milter.\+testctx.\+Test\+Ctx.\+\_\+body}, \textbf{ Milter.\+test.\+Test\+Base.\+\_\+bodyreplaced}, \textbf{ Milter.\+testctx.\+Test\+Ctx.\+\_\+bodyreplaced}, \textbf{ Milter.\+test.\+Test\+Base.\+\_\+envfromchanged}, \textbf{ Milter.\+testctx.\+Test\+Ctx.\+\_\+envfromchanged}, \textbf{ Milter.\+test.\+Test\+Base.\+\_\+macros}, \textbf{ Milter.\+testctx.\+Test\+Ctx.\+\_\+macros}, \textbf{ Milter.\+test.\+Test\+Base.\+\_\+sender}, \textbf{ Milter.\+testctx.\+Test\+Ctx.\+\_\+sender}, \textbf{ Milter.\+test.\+Test\+Base.\+\_\+stage}, Milter.\+testctx.\+Test\+Ctx.\+\_\+stage, \textbf{ Milter.\+test.\+Test\+Base.\+\_\+symlist}, \textbf{ Milter.\+testctx.\+Test\+Ctx.\+\_\+symlist}, \textbf{ Milter.\+Base.\+log()}, \textbf{ 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}
