From: richard Date: Wed, 15 May 2002 03:27:16 +0000 (+0000) Subject: . fixed SCRIPT_NAME in ZRoundup for instances not at top level of Zope X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=38c65e9e3806b6813aa2a7f15c782731aaddb983;p=roundup.git . fixed SCRIPT_NAME in ZRoundup for instances not at top level of Zope (thanks dman) . fixed some sorting issues that were breaking some unit tests under py2.2 . mailgw test output dir was confusing the init test (but only on 2.2 *shrug*) fixed bug in the init unit test that meant only the bsddb test ran if it could (it clobbered the anydbm test) git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@731 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/CHANGES.txt b/CHANGES.txt index 4ffa5fb..ddfb7c8 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -40,6 +40,8 @@ Fixed: . file upload broke if you didn't supply a change note . fixed SCRIPT_NAME in ZRoundup for instances not at top level of Zope (thanks dman) + . fixed some sorting issues that were breaking some unit tests under py2.2 + . mailgw test output dir was confusing the init test (but only on 2.2 *shrug*) 2002-03-25 - 0.4.1 diff --git a/roundup/roundupdb.py b/roundup/roundupdb.py index d126456..f870bb9 100644 --- a/roundup/roundupdb.py +++ b/roundup/roundupdb.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: roundupdb.py,v 1.51 2002-04-08 03:46:42 richard Exp $ +# $Id: roundupdb.py,v 1.52 2002-05-15 03:27:16 richard Exp $ __doc__ = """ Extending hyperdb with types specific to issue-tracking. @@ -423,6 +423,9 @@ class IssueClass(Class): # get the files for this message message_files = messages.get(msgid, 'files') + # make sure the To line is always the same (for testing mostly) + sendto.sort() + # create the message message = cStringIO.StringIO() writer = MimeWriter.MimeWriter(message) @@ -480,7 +483,8 @@ class IssueClass(Class): # now try to send the message if SENDMAILDEBUG: open(SENDMAILDEBUG, 'w').write('FROM: %s\nTO: %s\n%s\n'%( - self.db.config.ADMIN_EMAIL,', '.join(sendto),message.getvalue())) + self.db.config.ADMIN_EMAIL, + ', '.join(sendto),message.getvalue())) else: try: # send the message as admin so bounces are sent there @@ -535,6 +539,7 @@ class IssueClass(Class): key = link.labelprop(default_to_id=1) if key: value = [link.get(entry, key) for entry in value] + value.sort() value = ', '.join(value) m.append('%s: %s'%(propname, value)) m.insert(0, '----------') @@ -620,6 +625,9 @@ class IssueClass(Class): # # $Log: not supported by cvs2svn $ +# Revision 1.51 2002/04/08 03:46:42 richard +# make it work +# # Revision 1.50 2002/04/08 03:40:31 richard # . added a "detectors" directory for people to put their useful auditors and # reactors in. Note - the roundupdb.IssueClass.sendmessage method has been diff --git a/test/test_init.py b/test/test_init.py index 74017ba..b21a5ff 100644 --- a/test/test_init.py +++ b/test/test_init.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: test_init.py,v 1.7 2001-10-28 22:51:38 richard Exp $ +# $Id: test_init.py,v 1.8 2002-05-15 03:27:16 richard Exp $ import unittest, os, shutil, errno, imp, sys @@ -25,7 +25,7 @@ class MyTestCase(unittest.TestCase): count = 0 def setUp(self): MyTestCase.count = MyTestCase.count + 1 - self.dirname = '_test_%s'%self.count + self.dirname = '_test_init_%s'%self.count try: shutil.rmtree(self.dirname) except OSError, error: @@ -107,28 +107,30 @@ class ExtendedTestCase(MyTestCase): l = db.timelog.list() ae(l, []) +class bsddbClassicTestCase(ClassicTestCase): + backend = 'bsddb' +class bsddbExtendedTestCase(ExtendedTestCase): + backend = 'bsddb' + +class bsddb3ClassicTestCase(ClassicTestCase): + backend = 'bsddb3' +class bsddb3ExtendedTestCase(ExtendedTestCase): + backend = 'bsddb3' + def suite(): l = [unittest.makeSuite(ClassicTestCase, 'test'), unittest.makeSuite(ExtendedTestCase, 'test')] try: import bsddb - x = ClassicTestCase - x.backend = 'bsddb' - l.append(unittest.makeSuite(x, 'test')) - x = ExtendedTestCase - x.backend = 'bsddb' - l.append(unittest.makeSuite(x, 'test')) + l.append(unittest.makeSuite(bsddbClassicTestCase, 'test')) + l.append(unittest.makeSuite(bsddbExtendedTestCase, 'test')) except: print 'bsddb module not found, skipping bsddb DBTestCase' # try: # import bsddb3 -# x = ClassicTestCase -# x.backend = 'bsddb3' -# l.append(unittest.makeSuite(x, 'test')) -# x = ExtendedTestCase -# x.backend = 'bsddb3' -# l.append(unittest.makeSuite(x, 'test')) +# l.append(unittest.makeSuite(bsddb3ClassicTestCase, 'test')) +# l.append(unittest.makeSuite(bsddb3ExtendedTestCase, 'test')) # except: # print 'bsddb3 module not found, skipping bsddb3 DBTestCase' @@ -136,6 +138,9 @@ def suite(): # # $Log: not supported by cvs2svn $ +# Revision 1.7 2001/10/28 22:51:38 richard +# Fixed ENOENT/WindowsError thing, thanks Juergen Hermann +# # Revision 1.6 2001/09/29 23:48:06 richard # Bug fix for test_init on Windows. # More documenation!! diff --git a/test/test_mailgw.py b/test/test_mailgw.py index 1c50d99..956bc5f 100644 --- a/test/test_mailgw.py +++ b/test/test_mailgw.py @@ -8,7 +8,7 @@ # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# $Id: test_mailgw.py,v 1.17 2002-05-02 07:56:34 richard Exp $ +# $Id: test_mailgw.py,v 1.18 2002-05-15 03:27:16 richard Exp $ import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys, difflib @@ -25,10 +25,14 @@ class DiffHelper: ''' if s1 == s2: return - # under python2.1 we allow a difference of one trailing empty line. + + # under python2.[12] we allow a difference of one trailing empty line. if sys.version_info[0:2] == (2,1): if s1+'\n' == s2: return + if sys.version_info[0:2] == (2,2): + if s1 == s2+'\n': + return l1=s1.split('\n') l2=s2.split('\n') @@ -56,7 +60,7 @@ class MailgwTestCase(unittest.TestCase, DiffHelper): schema = 'classic' def setUp(self): MailgwTestCase.count = MailgwTestCase.count + 1 - self.dirname = '_test_%s'%self.count + self.dirname = '_test_mailgw_%s'%self.count try: shutil.rmtree(self.dirname) except OSError, error: @@ -97,7 +101,9 @@ This is a test submission of a new issue. if os.path.exists(os.environ['SENDMAILDEBUG']): error = open(os.environ['SENDMAILDEBUG']).read() self.assertEqual('no error', error) - self.assertEqual(self.db.issue.get(nodeid, 'nosy'), ['2', '3']) + l = self.db.issue.get(nodeid, 'nosy') + l.sort() + self.assertEqual(l, ['2', '3']) def testNewIssueNosy(self): self.instance.ADD_AUTHOR_TO_NOSY = 'yes' @@ -116,7 +122,9 @@ This is a test submission of a new issue. if os.path.exists(os.environ['SENDMAILDEBUG']): error = open(os.environ['SENDMAILDEBUG']).read() self.assertEqual('no error', error) - self.assertEqual(self.db.issue.get(nodeid, 'nosy'), ['2', '3']) + l = self.db.issue.get(nodeid, 'nosy') + l.sort() + self.assertEqual(l, ['2', '3']) def testAlternateAddress(self): message = cStringIO.StringIO('''Content-Type: text/plain; @@ -191,7 +199,7 @@ This is a test submission of a new issue. ---------- assignedto: richard messages: 1 -nosy: mary, Chef, richard +nosy: Chef, mary, richard status: unread title: Testing... ___________________________________________________ @@ -226,10 +234,10 @@ This is a followup self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), '''FROM: roundup-admin@fill.me.in. -TO: chef@bork.bork.bork, mary@test, john@test +TO: chef@bork.bork.bork, john@test, mary@test Content-Type: text/plain Subject: [issue1] Testing... -To: chef@bork.bork.bork, mary@test, john@test +To: chef@bork.bork.bork, john@test, mary@test From: richard Reply-To: Roundup issue tracker MIME-Version: 1.0 @@ -313,10 +321,10 @@ This is a followup self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), '''FROM: roundup-admin@fill.me.in. -TO: chef@bork.bork.bork, mary@test, john@test +TO: chef@bork.bork.bork, john@test, mary@test Content-Type: text/plain Subject: [issue1] Testing... -To: chef@bork.bork.bork, mary@test, john@test +To: chef@bork.bork.bork, john@test, mary@test From: richard Reply-To: Roundup issue tracker MIME-Version: 1.0 @@ -453,10 +461,10 @@ This is a followup self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(), '''FROM: roundup-admin@fill.me.in. -TO: john@test, chef@bork.bork.bork, richard@test +TO: chef@bork.bork.bork, john@test, richard@test Content-Type: text/plain Subject: [issue1] Testing... -To: john@test, chef@bork.bork.bork, richard@test +To: chef@bork.bork.bork, john@test, richard@test From: john Reply-To: Roundup issue tracker MIME-Version: 1.0 @@ -682,6 +690,14 @@ def suite(): # # $Log: not supported by cvs2svn $ +# Revision 1.17 2002/05/02 07:56:34 richard +# . added option to automatically add the authors and recipients of messages +# to the nosy lists with the options ADD_AUTHOR_TO_NOSY (default 'new') and +# ADD_RECIPIENTS_TO_NOSY (default 'new'). These settings emulate the current +# behaviour. Setting them to 'yes' will add the author/recipients to the nosy +# on messages that create issues and followup messages. +# . added missing documentation for a few of the config option values +# # Revision 1.16 2002/03/19 21:58:11 grubert # . for python2.1 test_mailgw compareString allows an extra trailing empty line (for quopri. #