Skip to content

Commit 59ad4ad

Browse files
author
Richard Jones
committed
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)
1 parent 43b86f8 commit 59ad4ad

File tree

4 files changed

+59
-28
lines changed

4 files changed

+59
-28
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ Fixed:
4040
. file upload broke if you didn't supply a change note
4141
. fixed SCRIPT_NAME in ZRoundup for instances not at top level of Zope
4242
(thanks dman)
43+
. fixed some sorting issues that were breaking some unit tests under py2.2
44+
. mailgw test output dir was confusing the init test (but only on 2.2 *shrug*)
4345

4446

4547
2002-03-25 - 0.4.1

roundup/roundupdb.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: roundupdb.py,v 1.51 2002-04-08 03:46:42 richard Exp $
18+
# $Id: roundupdb.py,v 1.52 2002-05-15 03:27:16 richard Exp $
1919

2020
__doc__ = """
2121
Extending hyperdb with types specific to issue-tracking.
@@ -423,6 +423,9 @@ def send_message(self, nodeid, msgid, note, sendto):
423423
# get the files for this message
424424
message_files = messages.get(msgid, 'files')
425425

426+
# make sure the To line is always the same (for testing mostly)
427+
sendto.sort()
428+
426429
# create the message
427430
message = cStringIO.StringIO()
428431
writer = MimeWriter.MimeWriter(message)
@@ -480,7 +483,8 @@ def send_message(self, nodeid, msgid, note, sendto):
480483
# now try to send the message
481484
if SENDMAILDEBUG:
482485
open(SENDMAILDEBUG, 'w').write('FROM: %s\nTO: %s\n%s\n'%(
483-
self.db.config.ADMIN_EMAIL,', '.join(sendto),message.getvalue()))
486+
self.db.config.ADMIN_EMAIL,
487+
', '.join(sendto),message.getvalue()))
484488
else:
485489
try:
486490
# send the message as admin so bounces are sent there
@@ -535,6 +539,7 @@ def generateCreateNote(self, nodeid):
535539
key = link.labelprop(default_to_id=1)
536540
if key:
537541
value = [link.get(entry, key) for entry in value]
542+
value.sort()
538543
value = ', '.join(value)
539544
m.append('%s: %s'%(propname, value))
540545
m.insert(0, '----------')
@@ -620,6 +625,9 @@ def generateChangeNote(self, nodeid, oldvalues):
620625

621626
#
622627
# $Log: not supported by cvs2svn $
628+
# Revision 1.51 2002/04/08 03:46:42 richard
629+
# make it work
630+
#
623631
# Revision 1.50 2002/04/08 03:40:31 richard
624632
# . added a "detectors" directory for people to put their useful auditors and
625633
# reactors in. Note - the roundupdb.IssueClass.sendmessage method has been

test/test_init.py

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: test_init.py,v 1.7 2001-10-28 22:51:38 richard Exp $
18+
# $Id: test_init.py,v 1.8 2002-05-15 03:27:16 richard Exp $
1919

2020
import unittest, os, shutil, errno, imp, sys
2121

@@ -25,7 +25,7 @@ class MyTestCase(unittest.TestCase):
2525
count = 0
2626
def setUp(self):
2727
MyTestCase.count = MyTestCase.count + 1
28-
self.dirname = '_test_%s'%self.count
28+
self.dirname = '_test_init_%s'%self.count
2929
try:
3030
shutil.rmtree(self.dirname)
3131
except OSError, error:
@@ -107,35 +107,40 @@ def testCreation(self):
107107
l = db.timelog.list()
108108
ae(l, [])
109109

110+
class bsddbClassicTestCase(ClassicTestCase):
111+
backend = 'bsddb'
112+
class bsddbExtendedTestCase(ExtendedTestCase):
113+
backend = 'bsddb'
114+
115+
class bsddb3ClassicTestCase(ClassicTestCase):
116+
backend = 'bsddb3'
117+
class bsddb3ExtendedTestCase(ExtendedTestCase):
118+
backend = 'bsddb3'
119+
110120
def suite():
111121
l = [unittest.makeSuite(ClassicTestCase, 'test'),
112122
unittest.makeSuite(ExtendedTestCase, 'test')]
113123
try:
114124
import bsddb
115-
x = ClassicTestCase
116-
x.backend = 'bsddb'
117-
l.append(unittest.makeSuite(x, 'test'))
118-
x = ExtendedTestCase
119-
x.backend = 'bsddb'
120-
l.append(unittest.makeSuite(x, 'test'))
125+
l.append(unittest.makeSuite(bsddbClassicTestCase, 'test'))
126+
l.append(unittest.makeSuite(bsddbExtendedTestCase, 'test'))
121127
except:
122128
print 'bsddb module not found, skipping bsddb DBTestCase'
123129

124130
# try:
125131
# import bsddb3
126-
# x = ClassicTestCase
127-
# x.backend = 'bsddb3'
128-
# l.append(unittest.makeSuite(x, 'test'))
129-
# x = ExtendedTestCase
130-
# x.backend = 'bsddb3'
131-
# l.append(unittest.makeSuite(x, 'test'))
132+
# l.append(unittest.makeSuite(bsddb3ClassicTestCase, 'test'))
133+
# l.append(unittest.makeSuite(bsddb3ExtendedTestCase, 'test'))
132134
# except:
133135
# print 'bsddb3 module not found, skipping bsddb3 DBTestCase'
134136

135137
return unittest.TestSuite(l)
136138

137139
#
138140
# $Log: not supported by cvs2svn $
141+
# Revision 1.7 2001/10/28 22:51:38 richard
142+
# Fixed ENOENT/WindowsError thing, thanks Juergen Hermann
143+
#
139144
# Revision 1.6 2001/09/29 23:48:06 richard
140145
# Bug fix for test_init on Windows.
141146
# More documenation!!

test/test_mailgw.py

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# but WITHOUT ANY WARRANTY; without even the implied warranty of
99
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1010
#
11-
# $Id: test_mailgw.py,v 1.17 2002-05-02 07:56:34 richard Exp $
11+
# $Id: test_mailgw.py,v 1.18 2002-05-15 03:27:16 richard Exp $
1212

1313
import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys, difflib
1414

@@ -25,10 +25,14 @@ def compareStrings(self, s2, s1):
2525
'''
2626
if s1 == s2:
2727
return
28-
# under python2.1 we allow a difference of one trailing empty line.
28+
29+
# under python2.[12] we allow a difference of one trailing empty line.
2930
if sys.version_info[0:2] == (2,1):
3031
if s1+'\n' == s2:
3132
return
33+
if sys.version_info[0:2] == (2,2):
34+
if s1 == s2+'\n':
35+
return
3236

3337
l1=s1.split('\n')
3438
l2=s2.split('\n')
@@ -56,7 +60,7 @@ class MailgwTestCase(unittest.TestCase, DiffHelper):
5660
schema = 'classic'
5761
def setUp(self):
5862
MailgwTestCase.count = MailgwTestCase.count + 1
59-
self.dirname = '_test_%s'%self.count
63+
self.dirname = '_test_mailgw_%s'%self.count
6064
try:
6165
shutil.rmtree(self.dirname)
6266
except OSError, error:
@@ -97,7 +101,9 @@ def testNewIssue(self):
97101
if os.path.exists(os.environ['SENDMAILDEBUG']):
98102
error = open(os.environ['SENDMAILDEBUG']).read()
99103
self.assertEqual('no error', error)
100-
self.assertEqual(self.db.issue.get(nodeid, 'nosy'), ['2', '3'])
104+
l = self.db.issue.get(nodeid, 'nosy')
105+
l.sort()
106+
self.assertEqual(l, ['2', '3'])
101107

102108
def testNewIssueNosy(self):
103109
self.instance.ADD_AUTHOR_TO_NOSY = 'yes'
@@ -116,7 +122,9 @@ def testNewIssueNosy(self):
116122
if os.path.exists(os.environ['SENDMAILDEBUG']):
117123
error = open(os.environ['SENDMAILDEBUG']).read()
118124
self.assertEqual('no error', error)
119-
self.assertEqual(self.db.issue.get(nodeid, 'nosy'), ['2', '3'])
125+
l = self.db.issue.get(nodeid, 'nosy')
126+
l.sort()
127+
self.assertEqual(l, ['2', '3'])
120128

121129
def testAlternateAddress(self):
122130
message = cStringIO.StringIO('''Content-Type: text/plain;
@@ -191,7 +199,7 @@ def testNewIssueAuthMsg(self):
191199
----------
192200
assignedto: richard
193201
messages: 1
194-
nosy: mary, Chef, richard
202+
nosy: Chef, mary, richard
195203
status: unread
196204
title: Testing...
197205
___________________________________________________
@@ -226,10 +234,10 @@ def testFollowup(self):
226234

227235
self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(),
228236
229-
TO: [email protected], mary@test, john@test
237+
TO: [email protected], john@test, mary@test
230238
Content-Type: text/plain
231239
Subject: [issue1] Testing...
232-
To: [email protected], mary@test, john@test
240+
To: [email protected], john@test, mary@test
233241
From: richard <[email protected].>
234242
Reply-To: Roundup issue tracker <[email protected].>
235243
MIME-Version: 1.0
@@ -313,10 +321,10 @@ def testFollowupTitleMatch(self):
313321

314322
self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(),
315323
316-
TO: [email protected], mary@test, john@test
324+
TO: [email protected], john@test, mary@test
317325
Content-Type: text/plain
318326
Subject: [issue1] Testing...
319-
To: [email protected], mary@test, john@test
327+
To: [email protected], john@test, mary@test
320328
From: richard <[email protected].>
321329
Reply-To: Roundup issue tracker <[email protected].>
322330
MIME-Version: 1.0
@@ -453,10 +461,10 @@ def testFollowupNosyAuthorAndCopy(self):
453461

454462
self.compareStrings(open(os.environ['SENDMAILDEBUG']).read(),
455463
456-
TO: john@test, [email protected], richard@test
464+
TO: [email protected], john@test, richard@test
457465
Content-Type: text/plain
458466
Subject: [issue1] Testing...
459-
To: john@test, [email protected], richard@test
467+
To: [email protected], john@test, richard@test
460468
From: john <[email protected].>
461469
Reply-To: Roundup issue tracker <[email protected].>
462470
MIME-Version: 1.0
@@ -682,6 +690,14 @@ def suite():
682690

683691
#
684692
# $Log: not supported by cvs2svn $
693+
# Revision 1.17 2002/05/02 07:56:34 richard
694+
# . added option to automatically add the authors and recipients of messages
695+
# to the nosy lists with the options ADD_AUTHOR_TO_NOSY (default 'new') and
696+
# ADD_RECIPIENTS_TO_NOSY (default 'new'). These settings emulate the current
697+
# behaviour. Setting them to 'yes' will add the author/recipients to the nosy
698+
# on messages that create issues and followup messages.
699+
# . added missing documentation for a few of the config option values
700+
#
685701
# Revision 1.16 2002/03/19 21:58:11 grubert
686702
# . for python2.1 test_mailgw compareString allows an extra trailing empty line (for quopri.
687703
#

0 commit comments

Comments
 (0)