summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ade2b8b)
raw | patch | inline | side by side (parent: ade2b8b)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Thu, 17 Apr 2003 06:51:44 +0000 (06:51 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Thu, 17 Apr 2003 06:51:44 +0000 (06:51 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1664 57a73879-2fb5-44c3-a270-3262357dd7e2
CHANGES.txt | patch | blob | history | |
roundup/mailgw.py | patch | blob | history | |
run_tests | patch | blob | history | |
test/test_cgi.py | patch | blob | history | |
test/test_init.py | patch | blob | history | |
test/test_mailgw.py | patch | blob | history |
diff --git a/CHANGES.txt b/CHANGES.txt
index 900ea99880ef891b7041dd4255dcb9668b4d1dae..2a93850b12edca41161e11636d5fa156b3418021 100644 (file)
--- a/CHANGES.txt
+++ b/CHANGES.txt
- Roundup templates are now distributed much more sanely, allowing for
3rd-party templates.
-
Fixed:
- applied unicode patch. All data is stored in utf-8. Incoming messages
converted from any encoding to utf-8, outgoing messages are encoded
diff --git a/roundup/mailgw.py b/roundup/mailgw.py
index 1a5332bb99027c4fed6a2378da084d617b205e0e..66102ebee56a4ffbaed38b8f50e99b20a0857d19 100644 (file)
--- a/roundup/mailgw.py
+++ b/roundup/mailgw.py
an exception, the original message is bounced back to the sender with the
explanatory message given in the exception.
-$Id: mailgw.py,v 1.115 2003-04-17 03:37:59 richard Exp $
+$Id: mailgw.py,v 1.116 2003-04-17 06:51:44 richard Exp $
'''
import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri
# couldn't match address or username, so create a new user
if create:
- return db.user.create(username=address, address=address,
+ # generate a username
+ if '@' in address:
+ username = address.split('@')[0]
+ else:
+ username = address
+ trying = username
+ n = 0
+ while 1:
+ try:
+ # does this username exist already?
+ db.user.lookup(trying)
+ except KeyError:
+ break
+ n += 1
+ trying = username + str(n)
+
+ # create!
+ return db.user.create(username=trying, address=address,
realname=realname, roles=db.config.NEW_EMAIL_USER_ROLES,
password=password.Password(password.generatePassword()),
**user_props)
diff --git a/run_tests b/run_tests
index febf5e559e03f7bd4919575b863ca0a5571908a1..0f0445c37a7f78d34c72dd28e42a0a677d288e32 100755 (executable)
--- a/run_tests
+++ b/run_tests
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
-# $Id: run_tests,v 1.8 2002-09-10 01:07:04 richard Exp $
-
-# make sure we have the htmlbase
-try:
- from roundup.templates.classic import htmlbase
-except ImportError:
- import setup
- setup.buildTemplates()
+# $Id: run_tests,v 1.9 2003-04-17 06:51:44 richard Exp $
from test import go
import sys
diff --git a/test/test_cgi.py b/test/test_cgi.py
index 85319e32c2d97275d615e7dd4609bad95b4ebbbe..d87f2ec6dc2888b16b618deb98cbe68829c73d91 100644 (file)
--- a/test/test_cgi.py
+++ b/test/test_cgi.py
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
-# $Id: test_cgi.py,v 1.14 2003-03-26 06:46:17 richard Exp $
+# $Id: test_cgi.py,v 1.15 2003-04-17 06:51:44 richard Exp $
import unittest, os, shutil, errno, sys, difflib, cgi, re
except OSError, error:
if error.errno not in (errno.ENOENT, errno.ESRCH): raise
# create the instance
- init.install(self.dirname, 'classic')
+ init.install(self.dirname, 'templates/classic')
init.write_select_db(self.dirname, 'anydbm')
init.initialise(self.dirname, 'sekrit')
# check we can load the package
diff --git a/test/test_init.py b/test/test_init.py
index b58d0cefa04a993467f1eb5881ff7e57faf48a68..e84c695f230c74db01701b06be15be416fd63b91 100644 (file)
--- a/test/test_init.py
+++ b/test/test_init.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: test_init.py,v 1.22 2003-03-18 00:50:24 richard Exp $
+# $Id: test_init.py,v 1.23 2003-04-17 06:51:44 richard Exp $
import unittest, os, shutil, errno, imp, sys
ae = self.assertEqual
# create the instance
- init.install(self.dirname, 'classic')
+ init.install(self.dirname, 'templates/classic')
init.write_select_db(self.dirname, self.backend)
init.initialise(self.dirname, 'sekrit')
diff --git a/test/test_mailgw.py b/test/test_mailgw.py
index 65a1eeafd354c621825d3ee56e3bcd9fd54f944d..138059bafc64a083a9285da2ba8c7c9a83b9b69d 100644 (file)
--- a/test/test_mailgw.py
+++ b/test/test_mailgw.py
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
-# $Id: test_mailgw.py,v 1.43 2003-04-10 05:11:58 richard Exp $
+# $Id: test_mailgw.py,v 1.44 2003-04-17 06:51:44 richard Exp $
import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys, difflib
import rfc822
except OSError, error:
if error.errno not in (errno.ENOENT, errno.ESRCH): raise
# create the instance
- init.install(self.dirname, 'classic')
+ init.install(self.dirname, 'templates/classic')
init.write_select_db(self.dirname, 'anydbm')
init.initialise(self.dirname, 'sekrit')
# check we can load the package
This is a test submission of a new issue.
-
----------
assignedto: richard
messages: 1
This is a second followup
-
----------
status: unread -> chatting
_______________________________________________________________________
This is a followup
-
----------
assignedto: -> mary
nosy: +john, mary
This is a followup
-
----------
assignedto: -> mary
nosy: +john, mary
This is a followup
-
----------
nosy: +john
status: unread -> chatting
This is a followup
-
----------
nosy: +john
status: unread -> chatting
This is a followup
-
----------
nosy: +john
status: unread -> chatting
This is a followup
-
----------
status: unread -> chatting
_______________________________________________________________________
This is a followup
-
----------
status: unread -> chatting
_______________________________________________________________________
''')
+ def testFollowupEmptyMessage(self):
+ self.doNewIssue()
+
+ message = cStringIO.StringIO('''Content-Type: text/plain;
+ charset="iso-8859-1"
+From: richard <richard@test>
+To: issue_tracker@your.tracker.email.domain.example
+Message-Id: <followup_dummy_id>
+In-Reply-To: <dummy_test_message_id>
+Subject: [issue1] Testing... [assignedto=mary; nosy=+john]
+
+''')
+ handler = self.instance.MailGW(self.instance, self.db)
+ handler.trapExceptions = 0
+ handler.main(message)
+ l = self.db.issue.get('1', 'nosy')
+ l.sort()
+ self.assertEqual(l, ['3', '4', '5', '6'])
+
+ # should be no file created (ie. no message)
+ assert not os.path.exists(os.environ['SENDMAILDEBUG'])
+
def testNosyRemove(self):
self.doNewIssue()
This is a followup
-
----------
status: unread -> chatting
_______________________________________________________________________
self.assertEqual(uidFromAddress(self.db, ('', 'USER2@foo.com'), 0), i)
self.assertEqual(uidFromAddress(self.db, ('', 'user2@foo.com'), 0), i)
+ def testUserCreate(self):
+ i = uidFromAddress(self.db, ('', 'user@foo.com'), 1)
+ self.assertNotEqual(uidFromAddress(self.db, ('', 'user@bar.com'), 1), i)
+
def suite():
l = [unittest.makeSuite(MailgwTestCase),
]