comparison test/test_mailgw.py @ 1792:2cd528577108

mailgw now accepts registration confirmation mail that uses otk For example, the following could be in the subject line: .-- key <32-char otk, such as Aj4euk4LZSAdwePohj90SME5SpopLETL>.
author Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
date Sat, 06 Sep 2003 10:21:18 +0000
parents ea1afeb64b45
children dbe541c1aa39
comparison
equal deleted inserted replaced
1791:bcdb2ed730b5 1792:2cd528577108
6 # 6 #
7 # This module is distributed in the hope that it will be useful, 7 # This module is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of 8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 # 10 #
11 # $Id: test_mailgw.py,v 1.46 2003-05-06 21:49:20 kedder Exp $ 11 # $Id: test_mailgw.py,v 1.47 2003-09-06 10:21:03 jlgijsbers Exp $
12 12
13 import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys, difflib 13 import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys, difflib
14 import rfc822 14 import rfc822
15 15
16 # Note: Should parse emails according to RFC2822 instead of performing a 16 # Note: Should parse emails according to RFC2822 instead of performing a
957 unicode_header = '[issue244] \xd0\xb0\xd0\xbd\xd0\xb4\xd1\x80\xd0\xb5\xd0\xb9' 957 unicode_header = '[issue244] \xd0\xb0\xd0\xbd\xd0\xb4\xd1\x80\xd0\xb5\xd0\xb9'
958 unicode_encoded = '=?utf-8?q?[issue244]_=D0=B0=D0=BD=D0=B4=D1=80=D0=B5=D0=B9?=' 958 unicode_encoded = '=?utf-8?q?[issue244]_=D0=B0=D0=BD=D0=B4=D1=80=D0=B5=D0=B9?='
959 self.assertEqual(rfc2822.encode_header(ascii_header), ascii_header) 959 self.assertEqual(rfc2822.encode_header(ascii_header), ascii_header)
960 self.assertEqual(rfc2822.encode_header(unicode_header), unicode_encoded) 960 self.assertEqual(rfc2822.encode_header(unicode_header), unicode_encoded)
961 961
962 def testRegistrationConfirmation(self):
963 otk = "Aj4euk4LZSAdwePohj90SME5SpopLETL"
964 self.db.otks.set(otk, username='johannes', __time='')
965 message = cStringIO.StringIO('''Content-Type: text/plain;
966 charset="iso-8859-1"
967 From: Chef <chef@bork.bork.bork>
968 To: issue_tracker@your.tracker.email.domain.example
969 Cc: richard@test
970 Message-Id: <dummy_test_message_id>
971 Subject: Re: Complete your registration to Roundup issue tracker
972 -- key %s
973
974 This is a test confirmation of registration.
975 ''' % otk)
976 handler = self.instance.MailGW(self.instance, self.db)
977 handler.trapExceptions = 0
978 handler.main(message)
979
980 self.db.user.lookup('johannes')
981
962 def suite(): 982 def suite():
963 l = [unittest.makeSuite(MailgwTestCase), 983 l = [unittest.makeSuite(MailgwTestCase),
964 ] 984 ]
985 l = [MailgwTestCase("testRegistrationConfirmation")]
965 return unittest.TestSuite(l) 986 return unittest.TestSuite(l)
966 987
967 988
968 # vim: set filetype=python ts=4 sw=4 et si 989 # vim: set filetype=python ts=4 sw=4 et si

Roundup Issue Tracker: http://roundup-tracker.org/