\doxysection{Milter.\+testctx.\+Test\+Ctx Class Reference}
\label{classMilter_1_1testctx_1_1TestCtx}\index{Milter.testctx.TestCtx@{Milter.testctx.TestCtx}}


\doxyref{Milter}{p.}{classMilter_1_1Milter} context for unit testing milter applications.  


Inheritance diagram for Milter.\+testctx.\+Test\+Ctx\+:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2.000000cm]{classMilter_1_1testctx_1_1TestCtx}
\end{center}
\end{figure}
\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_ac0be36f98160735960f5f00ed9c5029b}} 
def {\bfseries \+\_\+\+\_\+init\+\_\+\+\_\+} (self, logfile=\textquotesingle{}test/milter.\+log\textquotesingle{})
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_a6136daa137185161de7fea3a60b5862f}} 
def {\bfseries getpriv} (self)
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_a596929ef3f030e2d264e6a658110a7a4}} 
def {\bfseries setpriv} (self, priv)
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_a0bbf2bb36742c9e0e10dbbe00e46ce80}} 
def {\bfseries getsymval} (self, name)
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_a48ec0c742c64f5c4fcd4ea713eac2a25}} 
def {\bfseries setreply} (self, rcode, xcode, $\ast$msg)
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_ada24981206db1727235853dc64208455}} 
def {\bfseries setsymlist} (self, stage, macros)
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_a27aec656661a0fb3743a583dc2ba53ba}} 
def {\bfseries addheader} (self, field, value, idx)
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_ae294de1455f196c82806d1b25bb2097e}} 
def {\bfseries chgheader} (self, field, idx, value)
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_ab3dddff637ae4f4b396e1dd7e7408d3d}} 
def {\bfseries addrcpt} (self, rcpt, params)
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_a07a34a4f489a0f4dd9b1b3479be4b255}} 
def {\bfseries delrcpt} (self, rcpt)
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_aab24b65b520557ccfb39db4cc8603588}} 
def {\bfseries replacebody} (self, chunk)
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_a8313cd3e9c119996dbadd8afab4a54fc}} 
def {\bfseries chgfrom} (self, sender, params=None)
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_a4e1a0a996b69a453b65d57ab377272f4}} 
def {\bfseries quarantine} (self, reason)
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_a3967eddb157047ded9af5b307e3b4258}} 
def \textbf{ progress} (self)
\begin{DoxyCompactList}\small\item\em Reset activity timer. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Static Public Attributes}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_a5abf163215e13186d141fc8ad628ad83}} 
list {\bfseries default\+\_\+opts} = [Milter.\+CURR\+\_\+\+ACTS,0x1fffff,0,0]
\end{DoxyCompactItemize}
\doxysubsection*{Private Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_a8bd29f0f9d8d959411b76444eb25913b}} 
def {\bfseries \+\_\+setsymval} (self, name, val)
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_a035590d44432d7ed3d12da4b2a63a2f0}} 
def {\bfseries \+\_\+abort} (self)
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_a72ffdf784cff6bbc2cbc97ce74faf469}} 
def {\bfseries \+\_\+close} (self)
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_a1d6f2453ff33e9676bbb7102078ee423}} 
def {\bfseries \+\_\+negotiate} (self)
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_aa393e69789a9a75ba8db61c3dc0eacf1}} 
def {\bfseries \+\_\+connect} (self, host=\textquotesingle{}localhost\textquotesingle{}, helo=\textquotesingle{}spamrelay\textquotesingle{}, ip=\textquotesingle{}1.\+2.\+3.\+4\textquotesingle{})
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_ad4d1d9b0cccef5b579e80b156882353f}} 
def {\bfseries \+\_\+helo} (self, helo)
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_aec7bd8cfd7ca6d447f1968b6231a546b}} 
def {\bfseries \+\_\+envfrom} (self, $\ast$s)
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_ae64ec179dddf41697b72e5e5623b4f9a}} 
def {\bfseries \+\_\+envrcpt} (self, s)
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_ac8dae4938bfb31e30b8a96d54f5a7333}} 
def {\bfseries \+\_\+data} (self)
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_aa368ae6da8ec696cfb63be94413074be}} 
def {\bfseries \+\_\+header} (self, fld, val)
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_a2d6157797823ee2190f56fe3c142a4b5}} 
def {\bfseries \+\_\+eoh} (self)
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_a3a5ef01a558ef42f1eb8c1e6b3a0a3ae}} 
def {\bfseries \+\_\+feed\+\_\+body} (self, bfp)
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_acbcec2d1d0de03b1de7e248d96a5e723}} 
def {\bfseries \+\_\+eom} (self)
\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 ctx. \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}\end{DoxyCompactItemize}
\doxysubsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_a6c5c65a526d284a1059d5cae002020c4}} 
\textbf{ \+\_\+priv}
\begin{DoxyCompactList}\small\item\em Usually the \doxyref{Milter}{p.}{classMilter_1_1Milter} application derived from \doxyref{Milter.\+Base}{p.}{classMilter_1_1Base}. \end{DoxyCompactList}\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_a50ed6a4c73039f19a880cc3e5984d05f}} 
\textbf{ \+\_\+delrcpt}
\begin{DoxyCompactList}\small\item\em List of recipients deleted. \end{DoxyCompactList}\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_ae127ad34f6369fcdf961ca62558ec420}} 
\textbf{ \+\_\+addrcpt}
\begin{DoxyCompactList}\small\item\em List of recipients added. \end{DoxyCompactList}\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_a98347cc703272d102e279a9df7bebc32}} 
\textbf{ \+\_\+macros}
\begin{DoxyCompactList}\small\item\em Macros defined. \end{DoxyCompactList}\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_ab403ad47ed1f0b47d78e28ec41b4fad9}} 
\textbf{ \+\_\+reply}
\begin{DoxyCompactList}\small\item\em Reply codes and messages set by the milter. \end{DoxyCompactList}\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_a6f77bb1aebdead41ae7e3fda4ddce825}} 
\textbf{ \+\_\+symlist}
\begin{DoxyCompactList}\small\item\em The macros returned by protocol stage. \end{DoxyCompactList}\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_ae4bb1d60414ac4501866299debd30846}} 
\textbf{ \+\_\+body}
\begin{DoxyCompactList}\small\item\em The message body. \end{DoxyCompactList}\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_a5e3af4969583d476328ac64e5bb76421}} 
\textbf{ \+\_\+bodyreplaced}
\begin{DoxyCompactList}\small\item\em True if the milter replaced the message body. \end{DoxyCompactList}\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_a22251f96cca9ad0ee3fa33408020c584}} 
\textbf{ \+\_\+headerschanged}
\begin{DoxyCompactList}\small\item\em True if the milter changed any headers. \end{DoxyCompactList}\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_a08775c91e12481d36113e059673c5eaa}} 
\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_1testctx_1_1TestCtx_aec4a18642e8b73e6b9cf8c2a82f419d6}} 
\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_1testctx_1_1TestCtx_a5a5a3a74c8a9b40d1cfb36733ca737a2}} 
\textbf{ \+\_\+envfromchanged}
\begin{DoxyCompactList}\small\item\em True if the milter changed the envelope from. \end{DoxyCompactList}\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_a150dd922b0dcf9b0a202d523cf11d5ed}} 
\textbf{ \+\_\+opts}
\begin{DoxyCompactList}\small\item\em Negotiated options. \end{DoxyCompactList}\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_aacb0aa8a6c6864ca2648ddc10d7fb493}} 
\textbf{ \+\_\+activity}
\begin{DoxyCompactList}\small\item\em Last activity. \end{DoxyCompactList}\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_abb529439402e62586d7da51034c923ca}} 
{\bfseries \+\_\+stage}
\item 
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_af7a6a6e8e8f057aaa1e5370d819ef4ce}} 
{\bfseries \+\_\+protocol}
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
\doxyref{Milter}{p.}{classMilter_1_1Milter} context for unit testing milter applications. 

A substitute for \doxyref{milter.\+milter\+Context}{p.}{classmilter_1_1milterContext} that can be passed to \doxyref{Milter.\+Base.\+\_\+setctx()}{p.}{classMilter_1_1Base_ae03b64fb40aea2819c29ad806ac5f7ea}. \begin{DoxySince}{Since}
1.\+0.\+3 
\end{DoxySince}


\doxysubsection{Member Function Documentation}
\mbox{\label{classMilter_1_1testctx_1_1TestCtx_a11a9130acfc06027d6a5343dd697cd2a}} 
\index{Milter.testctx.TestCtx@{Milter.testctx.TestCtx}!\_feedFile@{\_feedFile}}
\index{\_feedFile@{\_feedFile}!Milter.testctx.TestCtx@{Milter.testctx.TestCtx}}
\doxysubsubsection{\_feedFile()}
{\footnotesize\ttfamily def Milter.\+testctx.\+Test\+Ctx.\+\_\+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})\hspace{0.3cm}{\ttfamily [private]}}



Feed a file like object to the ctx. 

Calls the callbacks in the same sequence as libmilter. 
\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.\+testctx.\+Test\+Ctx.\+\_\+data(), Milter.\+testctx.\+Test\+Ctx.\+\_\+envfrom(), Milter.\+testctx.\+Test\+Ctx.\+\_\+envrcpt(), Milter.\+testctx.\+Test\+Ctx.\+\_\+eoh(), Milter.\+testctx.\+Test\+Ctx.\+\_\+eom(), Milter.\+testctx.\+Test\+Ctx.\+\_\+feed\+\_\+body(), Milter.\+testctx.\+Test\+Ctx.\+\_\+header(), 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, and Milter.\+testctx.\+Test\+Ctx.\+\_\+reply.



Referenced by Milter.\+testctx.\+Test\+Ctx.\+\_\+feed\+Msg().

\mbox{\label{classMilter_1_1testctx_1_1TestCtx_aa31bf7e759e17f2311df0b6aca42e2e1}} 
\index{Milter.testctx.TestCtx@{Milter.testctx.TestCtx}!\_feedMsg@{\_feedMsg}}
\index{\_feedMsg@{\_feedMsg}!Milter.testctx.TestCtx@{Milter.testctx.TestCtx}}
\doxysubsubsection{\_feedMsg()}
{\footnotesize\ttfamily def Milter.\+testctx.\+Test\+Ctx.\+\_\+feed\+Msg (\begin{DoxyParamCaption}\item[{}]{self,  }\item[{}]{fname,  }\item[{}]{sender = {\ttfamily \char`\"{}spam@adv.com\char`\"{}},  }\item[{$\ast$}]{rcpts }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



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 Milter.\+testctx.\+Test\+Ctx.\+\_\+feed\+File().



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