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


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}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
def {\bfseries \+\_\+\+\_\+init\+\_\+\+\_\+}\label{classMilter_1_1test_1_1TestBase_a0cc32f9449a0a37562851b39a0ee3faa}

\item 
def {\bfseries log} (self, msg)\label{classMilter_1_1test_1_1TestBase_a888f1ec7538e01f031cec13071d4c4ff}

\item 
def {\bf setsymval} (self, name, val)
\begin{DoxyCompactList}\small\item\em Set a macro value. \end{DoxyCompactList}\item 
def {\bfseries getsymval} (self, name)\label{classMilter_1_1test_1_1TestBase_acf18850f87fb2daff6381f784f488fac}

\item 
def {\bfseries replacebody} (self, chunk)\label{classMilter_1_1test_1_1TestBase_a6c07c93eece38b0d80b3aeb67aef65b5}

\item 
def {\bfseries chgheader} (self, field, idx, value)\label{classMilter_1_1test_1_1TestBase_ad36239878e83cd8c0d612d7e184d5bea}

\item 
def {\bfseries addheader}\label{classMilter_1_1test_1_1TestBase_a8cff4a22faa595e2ee5d00cec5d8d4d2}

\item 
def {\bfseries delrcpt} (self, rcpt)\label{classMilter_1_1test_1_1TestBase_ae5064d55c6f262cc02f6f1ab667b59bb}

\item 
def {\bfseries addrcpt} (self, rcpt)\label{classMilter_1_1test_1_1TestBase_af01f8f7f8bda4b9b9bce23f322fc0d01}

\item 
def {\bf setreply} (self, rcode, xcode, msg)
\begin{DoxyCompactList}\small\item\em Save the reply codes and messages in self.\+\_\+reply. \end{DoxyCompactList}\item 
def {\bfseries setsymlist} (self, stage, macros)\label{classMilter_1_1test_1_1TestBase_a8790e6299f05cff3523cbc1feaacee3d}

\item 
def {\bf feed\+File} (self, fp, sender=\char`\"{}spam@adv.\+com\char`\"{}, rcpt=\char`\"{}victim@lamb.\+com\char`\"{}, rcpts)
\begin{DoxyCompactList}\small\item\em Feed a file like object to the milter. \end{DoxyCompactList}\item 
def {\bf feed\+Msg} (self, fname, sender=\char`\"{}spam@adv.\+com\char`\"{}, rcpts)
\begin{DoxyCompactList}\small\item\em Feed an email contained in a file to the milter. \end{DoxyCompactList}\item 
def {\bf connect}
\begin{DoxyCompactList}\small\item\em Call the connect and helo callbacks. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Public Attributes}
\begin{DoxyCompactItemize}
\item 
{\bfseries logfp}\label{classMilter_1_1test_1_1TestBase_ae576a5c9292c902cacf776706b51ee83}

\end{DoxyCompactItemize}
\subsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
{\bfseries \+\_\+protocol}\label{classMilter_1_1test_1_1TestBase_a554495134126b4604d7ec563bfdf3d10}

\item 
{\bf \+\_\+delrcpt}\label{classMilter_1_1test_1_1TestBase_ad72eb23389fe68f0bc0c8b88b1338c32}

\begin{DoxyCompactList}\small\item\em List of recipients deleted. \end{DoxyCompactList}\item 
{\bf \+\_\+addrcpt}\label{classMilter_1_1test_1_1TestBase_a36b1103fa4973f2aeb4628333b094d3c}

\begin{DoxyCompactList}\small\item\em List of recipients added. \end{DoxyCompactList}\item 
{\bf \+\_\+macros}\label{classMilter_1_1test_1_1TestBase_a3650cd21768a663a737e8640df2d5e96}

\begin{DoxyCompactList}\small\item\em Macros defined. \end{DoxyCompactList}\item 
{\bf \+\_\+body}
\begin{DoxyCompactList}\small\item\em The message body. \end{DoxyCompactList}\item 
{\bf \+\_\+bodyreplaced}
\begin{DoxyCompactList}\small\item\em True if the milter replaced the message body. \end{DoxyCompactList}\item 
{\bf \+\_\+headerschanged}
\begin{DoxyCompactList}\small\item\em True if the milter changed any headers. \end{DoxyCompactList}\item 
{\bf \+\_\+reply}\label{classMilter_1_1test_1_1TestBase_a6a00a684cc746f4c5d00bab5a6cfa89f}

\begin{DoxyCompactList}\small\item\em Reply codes and messages set by the milter. \end{DoxyCompactList}\item 
{\bf \+\_\+msg}
\begin{DoxyCompactList}\small\item\em The rfc822 message object for the current email being fed to the milter. \end{DoxyCompactList}\item 
{\bfseries \+\_\+symlist}\label{classMilter_1_1test_1_1TestBase_aa8452abd02ee8cf5dfcf4b3d9daa697e}

\end{DoxyCompactItemize}


\subsection{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{DoxySince}{Since}
0.\+9.\+8 
\end{DoxySince}


\subsection{Member Function Documentation}
\index{Milter\+::test\+::\+Test\+Base@{Milter\+::test\+::\+Test\+Base}!connect@{connect}}
\index{connect@{connect}!Milter\+::test\+::\+Test\+Base@{Milter\+::test\+::\+Test\+Base}}
\subsubsection[{connect}]{\setlength{\rightskip}{0pt plus 5cm}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}
)}\label{classMilter_1_1test_1_1TestBase_a36eabddf195827bfe812bb609fb8d993}


Call the connect and helo callbacks. 

The helo callback is not called if connect does not return C\+O\+N\+T\+I\+N\+U\+E. 
\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 I\+P address passed to the connect callback \\
\hline
\end{DoxyParams}


References Milter.\+test.\+Test\+Base.\+\_\+body, Milter.\+test.\+Test\+Base.\+\_\+bodyreplaced, Milter.\+greysql.\+Greylist.\+close(), Milter.\+greylist.\+Greylist.\+close(), Milter.\+Base.\+close(), Milter.\+Milter.\+close(), Milter.\+Base.\+hello(), Milter.\+Milter.\+hello(), and Milter.\+Base.\+negotiate().

\index{Milter\+::test\+::\+Test\+Base@{Milter\+::test\+::\+Test\+Base}!feed\+File@{feed\+File}}
\index{feed\+File@{feed\+File}!Milter\+::test\+::\+Test\+Base@{Milter\+::test\+::\+Test\+Base}}
\subsubsection[{feed\+File}]{\setlength{\rightskip}{0pt plus 5cm}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[{}]{rcpts}
\end{DoxyParamCaption}
)}\label{classMilter_1_1test_1_1TestBase_a6062f0edad6f0bbb68e12bb057144fee}


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 C\+O\+N\+T\+I\+N\+U\+E 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 M\+A\+I\+L F\+R\+O\+M \\
\hline
{\em rcpt} & R\+C\+P\+T T\+O -\/ additional recipients may follow \\
\hline
\end{DoxyParams}


References Milter.\+test.\+Test\+Base.\+\_\+body, Milter.\+test.\+Test\+Base.\+\_\+bodyreplaced, Milter.\+test.\+Test\+Base.\+\_\+headerschanged, Milter.\+test.\+Test\+Base.\+\_\+msg, Milter.\+test.\+Test\+Base.\+\_\+reply, Milter.\+Base.\+body(), Milter.\+Base.\+envfrom(), Milter.\+Milter.\+envfrom(), Milter.\+Base.\+envrcpt(), Milter.\+Milter.\+envrcpt(), Milter.\+Base.\+eoh(), Milter.\+Milter.\+eoh(), Milter.\+Base.\+eom(), Milter.\+Milter.\+eom(), Milter.\+Base.\+header(), and Milter.\+Milter.\+header().



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

\index{Milter\+::test\+::\+Test\+Base@{Milter\+::test\+::\+Test\+Base}!feed\+Msg@{feed\+Msg}}
\index{feed\+Msg@{feed\+Msg}!Milter\+::test\+::\+Test\+Base@{Milter\+::test\+::\+Test\+Base}}
\subsubsection[{feed\+Msg}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+test.\+Test\+Base.\+feed\+Msg (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{fname, }
\item[{}]{sender = {\ttfamily \char`\"{}spam@adv.com\char`\"{}}, }
\item[{}]{rcpts}
\end{DoxyParamCaption}
)}\label{classMilter_1_1test_1_1TestBase_a18c1ca1bdb68f5b16f1219a3e90b920a}


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_a6062f0edad6f0bbb68e12bb057144fee}. 
\begin{DoxyParams}{Parameters}
{\em sender} & M\+A\+I\+L F\+R\+O\+M \\
\hline
{\em rcpts} & R\+C\+P\+T T\+O, multiple recipients may be supplied \\
\hline
\end{DoxyParams}


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

\index{Milter\+::test\+::\+Test\+Base@{Milter\+::test\+::\+Test\+Base}!setreply@{setreply}}
\index{setreply@{setreply}!Milter\+::test\+::\+Test\+Base@{Milter\+::test\+::\+Test\+Base}}
\subsubsection[{setreply}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+test.\+Test\+Base.\+setreply (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{rcode, }
\item[{}]{xcode, }
\item[{}]{msg}
\end{DoxyParamCaption}
)}\label{classMilter_1_1test_1_1TestBase_adf2bb006f89b640a1a552420ab1a6761}


Save the reply codes and messages in self.\+\_\+reply. 



References Milter.\+Base.\+\_\+actions, Milter.\+test.\+Test\+Base.\+\_\+reply, and Milter.\+test.\+Test\+Base.\+\_\+symlist.

\index{Milter\+::test\+::\+Test\+Base@{Milter\+::test\+::\+Test\+Base}!setsymval@{setsymval}}
\index{setsymval@{setsymval}!Milter\+::test\+::\+Test\+Base@{Milter\+::test\+::\+Test\+Base}}
\subsubsection[{setsymval}]{\setlength{\rightskip}{0pt plus 5cm}def Milter.\+test.\+Test\+Base.\+setsymval (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{name, }
\item[{}]{val}
\end{DoxyParamCaption}
)}\label{classMilter_1_1test_1_1TestBase_a2b863aee79cab3a421460ce18bc34ada}


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.\+test.\+Test\+Base.\+\_\+bodyreplaced, Milter.\+test.\+Test\+Base.\+\_\+headerschanged, Milter.\+test.\+Test\+Base.\+\_\+macros, Milter.\+test.\+Test\+Base.\+\_\+msg, Milter.\+test.\+Test\+Base.\+log(), Milter.\+Base.\+log(), and Milter.\+Milter.\+log().



\subsection{Member Data Documentation}
\index{Milter\+::test\+::\+Test\+Base@{Milter\+::test\+::\+Test\+Base}!\+\_\+body@{\+\_\+body}}
\index{\+\_\+body@{\+\_\+body}!Milter\+::test\+::\+Test\+Base@{Milter\+::test\+::\+Test\+Base}}
\subsubsection[{\+\_\+body}]{\setlength{\rightskip}{0pt plus 5cm}Milter.\+test.\+Test\+Base.\+\_\+body\hspace{0.3cm}{\ttfamily [private]}}\label{classMilter_1_1test_1_1TestBase_a91f2c2958adb1b070219caed7a4a3bec}


The message body. 



Referenced by Milter.\+test.\+Test\+Base.\+connect(), Milter.\+test.\+Test\+Base.\+feed\+File(), and Milter.\+test.\+Test\+Base.\+setsymval().

\index{Milter\+::test\+::\+Test\+Base@{Milter\+::test\+::\+Test\+Base}!\+\_\+bodyreplaced@{\+\_\+bodyreplaced}}
\index{\+\_\+bodyreplaced@{\+\_\+bodyreplaced}!Milter\+::test\+::\+Test\+Base@{Milter\+::test\+::\+Test\+Base}}
\subsubsection[{\+\_\+bodyreplaced}]{\setlength{\rightskip}{0pt plus 5cm}Milter.\+test.\+Test\+Base.\+\_\+bodyreplaced\hspace{0.3cm}{\ttfamily [private]}}\label{classMilter_1_1test_1_1TestBase_a26c23edb207941eafc4047322c29baa2}


True if the milter replaced the message body. 



Referenced by Milter.\+test.\+Test\+Base.\+connect(), Milter.\+test.\+Test\+Base.\+feed\+File(), and Milter.\+test.\+Test\+Base.\+setsymval().

\index{Milter\+::test\+::\+Test\+Base@{Milter\+::test\+::\+Test\+Base}!\+\_\+headerschanged@{\+\_\+headerschanged}}
\index{\+\_\+headerschanged@{\+\_\+headerschanged}!Milter\+::test\+::\+Test\+Base@{Milter\+::test\+::\+Test\+Base}}
\subsubsection[{\+\_\+headerschanged}]{\setlength{\rightskip}{0pt plus 5cm}Milter.\+test.\+Test\+Base.\+\_\+headerschanged\hspace{0.3cm}{\ttfamily [private]}}\label{classMilter_1_1test_1_1TestBase_a7ec00842c93705982e451d6e1b0a4cd4}


True if the milter changed any headers. 



Referenced by Milter.\+test.\+Test\+Base.\+feed\+File(), and Milter.\+test.\+Test\+Base.\+setsymval().

\index{Milter\+::test\+::\+Test\+Base@{Milter\+::test\+::\+Test\+Base}!\+\_\+msg@{\+\_\+msg}}
\index{\+\_\+msg@{\+\_\+msg}!Milter\+::test\+::\+Test\+Base@{Milter\+::test\+::\+Test\+Base}}
\subsubsection[{\+\_\+msg}]{\setlength{\rightskip}{0pt plus 5cm}Milter.\+test.\+Test\+Base.\+\_\+msg\hspace{0.3cm}{\ttfamily [private]}}\label{classMilter_1_1test_1_1TestBase_a197497e481c38a59a313a55d8dc6f280}


The rfc822 message object for the current email being fed to the milter. 



Referenced by Milter.\+test.\+Test\+Base.\+feed\+File(), and Milter.\+test.\+Test\+Base.\+setsymval().



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