diff --git a/test/test_mailgw.py b/test/test_mailgw.py
index 749a93c0472f493014d60cbaadcd8eab137cdebd..b35f3567b374e9393fdfa9df1c2511eed2fd2314 100644 (file)
--- a/test/test_mailgw.py
+++ b/test/test_mailgw.py
# Add Web Access role to anonymous, and try again to make sure
# we get a "please register at:" message this time.
p = [
- db.security.getPermission('Create', 'user'),
+ db.security.getPermission('Register', 'user'),
db.security.getPermission('Web Access', None),
]
db.security.role['anonymous'].permissions=p
''' set up callback for db open '''
# now with the permission
p = [
- db.security.getPermission('Create', 'user'),
+ db.security.getPermission('Register', 'user'),
db.security.getPermission('Email Access', None),
]
db.security.role['anonymous'].permissions=p
m.sort()
self.assertNotEqual(l, m)
- def testNewUserAuthorHighBit(self):
+ def testNewUserAuthorEncodedName(self):
l = set(self.db.user.list())
# From: name has Euro symbol in it
message = '''Content-Type: text/plain;
def hook (db, **kw):
''' set up callback for db open '''
p = [
- db.security.getPermission('Create', 'user'),
+ db.security.getPermission('Register', 'user'),
db.security.getPermission('Email Access', None),
+ db.security.getPermission('Create', 'issue'),
+ db.security.getPermission('Create', 'msg'),
]
- db.security.role['anonymous'].permissions=p
+ db.security.role['anonymous'].permissions = p
self.instance.schema_hook = hook
self._handle_mail(message)
m = set(self.db.user.list())
-You are not a registered user.
+You are not a registered user. Please register at:
+
+http://tracker.example/cgi-bin/roundup.cgi/bugs/user?template=register
+
+...before sending mail to the tracker.
Unknown address: nonexisting@bork.bork.bork
''')
def testEnc01(self):
+ self.db.user.set(self.mary_id,
+ realname='\xe4\xf6\xfc\xc4\xd6\xdc\xdf, Mary'.decode
+ ('latin-1').encode('utf-8'))
self.doNewIssue()
self._handle_mail('''Content-Type: text/plain;
charset="iso-8859-1"
Content-Type: text/plain; charset="utf-8"
Subject: [issue1] Testing...
To: chef@bork.bork.bork, richard@test.test
-From: "Contrary, Mary" <issue_tracker@your.tracker.email.domain.example>
+From: =?utf-8?b?w6TDtsO8w4TDlsOcw58sIE1hcnk=?=
+ <issue_tracker@your.tracker.email.domain.example>
Reply-To: Roundup issue tracker <issue_tracker@your.tracker.email.domain.example>
MIME-Version: 1.0
Message-Id: <followup_dummy_id>
Content-Transfer-Encoding: quoted-printable
-Contrary, Mary <mary@test.test> added the comment:
+=C3=A4=C3=B6=C3=BC=C3=84=C3=96=C3=9C=C3=9F, Mary <mary@test.test> added the=
+ comment:
A message with encoding (encoded oe =C3=B6)
assert nodeid1 == nodeid2
self.assertEqual(self.db.issue.get(nodeid2, 'title'), "Testing...")
+ def testSecurityMessagePermissionContent(self):
+ id = self.doNewIssue()
+ issue = self.db.issue.getnode (id)
+ self.db.security.addRole(name='Nomsg')
+ self.db.security.addPermissionToRole('Nomsg', 'Email Access')
+ for cl in 'issue', 'file', 'keyword':
+ for p in 'View', 'Edit', 'Create':
+ self.db.security.addPermissionToRole('Nomsg', p, cl)
+ self.db.user.set(self.mary_id, roles='Nomsg')
+ nodeid = self._handle_mail('''Content-Type: text/plain;
+ charset="iso-8859-1"
+From: Chef <chef@bork.bork.bork>
+To: issue_tracker@your.tracker.email.domain.example
+Message-Id: <dummy_test_message_id>
+Subject: [issue%(id)s] Testing... [nosy=+mary]
+
+Just a test reply
+'''%locals())
+ assert os.path.exists(SENDMAILDEBUG)
+ self.compareMessages(self._get_mail(),
+'''FROM: roundup-admin@your.tracker.email.domain.example
+TO: chef@bork.bork.bork, richard@test.test
+Content-Type: text/plain; charset="utf-8"
+Subject: [issue1] Testing...
+To: richard@test.test
+From: "Bork, Chef" <issue_tracker@your.tracker.email.domain.example>
+Reply-To: Roundup issue tracker <issue_tracker@your.tracker.email.domain.example>
+MIME-Version: 1.0
+Message-Id: <dummy_test_message_id>
+X-Roundup-Name: Roundup issue tracker
+X-Roundup-Loop: hello
+X-Roundup-Issue-Status: chatting
+Content-Transfer-Encoding: quoted-printable
+
+
+Bork, Chef <chef@bork.bork.bork> added the comment:
+
+Just a test reply
+
+----------
+nosy: +mary
+status: unread -> chatting
+
+_______________________________________________________________________
+Roundup issue tracker <issue_tracker@your.tracker.email.domain.example>
+<http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1>
+_______________________________________________________________________
+''')
+
def test_suite():
suite = unittest.TestSuite()