bernhard: utils/testing send_filtertest_emails.py,1.3,1.4
cvs at intevation.de
cvs at intevation.de
Wed Jun 1 15:38:18 CEST 2005
Author: bernhard
Update of /kolabrepository/utils/testing
In directory doto:/tmp/cvs-serv16689
Modified Files:
send_filtertest_emails.py
Log Message:
Forcing --smtp-host now, as we must not come from 127.0.0.1
to actually trigger the check we want to test.
Added new test #2 that tests the check with producing a bounce.
Added new test #3 to test issue744.
Index: send_filtertest_emails.py
===================================================================
RCS file: /kolabrepository/utils/testing/send_filtertest_emails.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- send_filtertest_emails.py 1 Jun 2005 11:13:19 -0000 1.3
+++ send_filtertest_emails.py 1 Jun 2005 13:38:16 -0000 1.4
@@ -5,13 +5,15 @@
with the real values for a test account on your server.
Need to be run from a server that can give emails to postfix
-without authentification. Typical use is on a Kolab2 server.
+without authentification.
+Typically use an IP of priviledge networks of your Kolab server.
+Attention: "envelope header from check" does not check mail from 127.0.0.1,
+so do NOT use localhost.
This script is Free Software under the GNU General Public License >=v2.
Bernhard Reiter <bernhard at intevation.de>
"""
#20041217 Bernhard initial
-#20041222 Bernhard Herzog.
__version__="$Revision$"[10:-1]
import sys
@@ -22,7 +24,7 @@
import getopt
def send_mail(envelope_from, envelope_to, header_from, header_to,
- test_number=0, smtp_host="localhost", smtp_port = None):
+ test_number=-1, smtp_host="localhost", smtp_port = None):
basemsg=("From: %s\r\nTo: %s\r\n%%s\r\n" %
(header_from, string.join(header_to, ", "))
@@ -77,7 +79,7 @@
realname = None
# SMTP host and port to use when sending the test mails
- smtp_host = "localhost"
+ smtp_host = None
smtp_port = 25
# parse the command line
@@ -110,6 +112,9 @@
if username is None:
print >>sys.stderr, "--username missing"
error = True
+ if smtp_host is None:
+ print >>sys.stderr, "--smtp-host missing"
+ error = True
if error:
sys.exit(1)
@@ -120,14 +125,27 @@
envelope_from = envelope_to
header_from = assemble_email_address(username, maildomain)
+ # Tests
+ # number : expected behaviour to pass the test : description
+
+ # 0: delivered: Are we functional? Do the standard settings work?
send_mail(envelope_from, envelope_to, header_from, header_to, 0,
smtp_host = smtp_host, smtp_port = smtp_port)
- # First test: different letter cases in the header_from, should go
- # through
+
+ # 1: delivered: different letter cases in the header_from
send_mail(envelope_from, envelope_to, header_from.swapcase(), header_to, 1,
smtp_host = smtp_host, smtp_port = smtp_port)
+ # 2: bounce mail: different from and host envelope
+ send_mail(envelope_from, envelope_to, "rumpelstilzchen at big.local",
+ header_to, 2,
+ smtp_host = smtp_host, smtp_port = smtp_port)
+
+ # 3: delivered, no mailer-daemon in kolabfilter log:
+ # issue774 (null senders not handled by kolabfilter...)
+ send_mail("<>", envelope_to, "some at non-existing.local", header_to, 3,
+ smtp_host = smtp_host, smtp_port = smtp_port)
if __name__=="__main__":
main(sys.argv)
More information about the commits
mailing list