[Spambayes-checkins]
spambayes/spambayes/test test_sb_server.py, 1.3, 1.4
Tony Meyer
anadelonbrin at users.sourceforge.net
Tue Dec 21 00:26:38 CET 2004
Update of /cvsroot/spambayes/spambayes/spambayes/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24839/spambayes/test
Modified Files:
test_sb_server.py
Log Message:
If run with no options, run the test (like the other scripts - I always forget to
use -z). Help is still available with -h.
Modify the server a little to test that servers that return the size of messages with
the +OK in a RETR will work.
Index: test_sb_server.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/test/test_sb_server.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** test_sb_server.py 29 Nov 2004 00:11:47 -0000 1.3
--- test_sb_server.py 20 Dec 2004 23:26:33 -0000 1.4
***************
*** 3,7 ****
"""Test the POP3 proxy is working correctly.
! When using the -z command line option, carries out a test that the
POP3 proxy can be connected to, that incoming mail is classified,
that pipelining is removed from the CAPA[bility] query, and that the
--- 3,7 ----
"""Test the POP3 proxy is working correctly.
! Given no command line options, carries out a test that the
POP3 proxy can be connected to, that incoming mail is classified,
that pipelining is removed from the CAPA[bility] query, and that the
***************
*** 17,26 ****
options:
- -z : Runs a self-test and exits.
-t : Runs a fake POP3 server on port 8110 (for testing).
-h : Displays this help message.
"""
! # This module is part of the spambayes project, which is Copyright 2002
# The Python Software Foundation and is covered by the Python Software
# Foundation license.
--- 17,25 ----
options:
-t : Runs a fake POP3 server on port 8110 (for testing).
-h : Displays this help message.
"""
! # This module is part of the spambayes project, which is Copyright 2002-5
# The Python Software Foundation and is covered by the Python Software
# Foundation license.
***************
*** 77,80 ****
--- 76,83 ----
"""
+ # An example of a particularly nasty malformed message - where there is
+ # no body, and no separator, which would at one point slip through
+ # SpamBayes. This is an example that Tony made up.
+
malformed1 = """From: ta-meyer at ihug.co.nz
Subject: No body, and no separator"""
***************
*** 225,229 ****
headers, body = message.split('\n\n', 1)
except ValueError:
! return "+OK\r\n%s\r\n.\r\n" % message
bodyLines = body.split('\n')[:maxLines]
message = headers + '\r\n\r\n' + '\n'.join(bodyLines)
--- 228,233 ----
headers, body = message.split('\n\n', 1)
except ValueError:
! return "+OK %d octets\r\n%s\r\n.\r\n" % (len(message),
! message)
bodyLines = body.split('\n')[:maxLines]
message = headers + '\r\n\r\n' + '\n'.join(bodyLines)
***************
*** 364,373 ****
# Read the arguments.
try:
! opts, args = getopt.getopt(sys.argv[1:], 'htz')
except getopt.error, msg:
print >>sys.stderr, str(msg) + '\n\n' + __doc__
sys.exit()
! runSelfTest = False
for opt, arg in opts:
if opt == '-h':
--- 368,378 ----
# Read the arguments.
try:
! opts, args = getopt.getopt(sys.argv[1:], 'ht')
except getopt.error, msg:
print >>sys.stderr, str(msg) + '\n\n' + __doc__
sys.exit()
! state.isTest = True
! runSelfTest = True
for opt, arg in opts:
if opt == '-h':
***************
*** 377,383 ****
state.isTest = True
state.runTestServer = True
! elif opt == '-z':
! state.isTest = True
! runSelfTest = True
state.createWorkers()
--- 382,386 ----
state.isTest = True
state.runTestServer = True
! runSelfTest = False
state.createWorkers()
***************
*** 394,399 ****
asyncore.loop()
- else:
- print >>sys.stderr, __doc__
if __name__ == '__main__':
--- 397,400 ----
More information about the Spambayes-checkins
mailing list