comparison test/test_mailgw.py @ 1410:3a853f1c20b5 maint-0.5

backporting fixes from HEAD
author Richard Jones <richard@users.sourceforge.net>
date Thu, 06 Feb 2003 05:44:49 +0000
parents 83f33642d220
children 905f92b97d4e
comparison
equal deleted inserted replaced
1401:6b3a20ffb343 1410:3a853f1c20b5
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.37 2002-12-18 00:42:03 richard Exp $ 11 # $Id: test_mailgw.py,v 1.37.2.1 2003-02-06 05:44:49 richard 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 14
15 # Note: Should parse emails according to RFC2822 instead of performing a 15 # Note: Should parse emails according to RFC2822 instead of performing a
16 # literal string comparision. Parsing the messages allows the tests to work for 16 # literal string comparision. Parsing the messages allows the tests to work for
778 Roundup issue tracker <issue_tracker@your.tracker.email.domain.example> 778 Roundup issue tracker <issue_tracker@your.tracker.email.domain.example>
779 http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1 779 http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1
780 _______________________________________________________________________ 780 _______________________________________________________________________
781 ''') 781 ''')
782 782
783 def testContentDisposition(self):
784 self.doNewIssue()
785 message = cStringIO.StringIO('''Content-Type: text/plain;
786 charset="iso-8859-1"
787 From: mary <mary@test>
788 To: issue_tracker@your.tracker.email.domain.example
789 Message-Id: <followup_dummy_id>
790 In-Reply-To: <dummy_test_message_id>
791 Subject: [issue1] Testing...
792 Content-Type: multipart/mixed; boundary="bCsyhTFzCvuiizWE"
793 Content-Disposition: inline
794
795
796 --bCsyhTFzCvuiizWE
797 Content-Type: text/plain; charset=us-ascii
798 Content-Disposition: inline
799
800 test attachment binary
801
802 --bCsyhTFzCvuiizWE
803 Content-Type: application/octet-stream
804 Content-Disposition: attachment; filename="main.dvi"
805
806 xxxxxx
807
808 --bCsyhTFzCvuiizWE--
809 ''')
810 handler = self.instance.MailGW(self.instance, self.db)
811 handler.trapExceptions = 0
812 handler.main(message)
813 messages = self.db.issue.get('1', 'messages')
814 messages.sort()
815 file = self.db.msg.get(messages[-1], 'files')[0]
816 self.assertEqual(self.db.file.get(file, 'name'), 'main.dvi')
817
783 def testFollowupStupidQuoting(self): 818 def testFollowupStupidQuoting(self):
784 self.doNewIssue() 819 self.doNewIssue()
785 820
786 message = cStringIO.StringIO('''Content-Type: text/plain; 821 message = cStringIO.StringIO('''Content-Type: text/plain;
787 charset="iso-8859-1" 822 charset="iso-8859-1"

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