Call negotiate from test mixin so that the noreply exception works.

This commit is contained in:
Stuart Gathman
2013-03-11 23:52:21 +00:00
parent bd0df5d77a
commit a180b212c6
+5 -2
View File
@@ -5,14 +5,16 @@ import rfc822
import StringIO import StringIO
import Milter import Milter
Milter.NOREPLY = Milter.CONTINUE
## Test mixin for unit testing milter applications. ## Test mixin for unit testing milter applications.
# This mixin overrides many Milter.MilterBase methods # This mixin overrides many Milter.MilterBase methods
# with stub versions that simply record what was done. # with stub versions that simply record what was done.
# @since 0.9.8 # @since 0.9.8
class TestBase(object): class TestBase(object):
_protocol = 0
def __init__(self,logfile='test/milter.log'): def __init__(self,logfile='test/milter.log'):
self._protocol = 0
self.logfp = open(logfile,"a") self.logfp = open(logfile,"a")
## List of recipients deleted ## List of recipients deleted
self._delrcpt = [] self._delrcpt = []
@@ -178,6 +180,8 @@ class TestBase(object):
def connect(self,host='localhost',helo='spamrelay',ip='1.2.3.4'): def connect(self,host='localhost',helo='spamrelay',ip='1.2.3.4'):
self._body = None self._body = None
self._bodyreplaced = False self._bodyreplaced = False
opts = [ Milter.CURR_ACTS,~0,0,0 ]
rc = self.negotiate(opts)
rc = super(TestBase,self).connect(host,1,(ip,1234)) rc = super(TestBase,self).connect(host,1,(ip,1234))
if rc != Milter.CONTINUE: if rc != Milter.CONTINUE:
self.close() self.close()
@@ -186,4 +190,3 @@ class TestBase(object):
if rc != Milter.CONTINUE: if rc != Milter.CONTINUE:
self.close() self.close()
return rc return rc