|
| 1 | +# -*- encoding: utf-8 -*- |
1 | 2 | # |
2 | 3 | # Copyright (c) 2001 Richard Jones, [email protected]. |
3 | 4 | # This module is free software, and you may redistribute it and/or modify |
|
23 | 24 | from roundup.mailgw import MailGW, Unauthorized, uidFromAddress, \ |
24 | 25 | parseContent, IgnoreLoop, IgnoreBulk, MailUsageError, MailUsageHelp |
25 | 26 | from roundup import init, instance, password, rfc2822, __version__ |
| 27 | +from roundup.anypy.sets_ import set |
26 | 28 |
|
27 | 29 | import db_test_base |
28 | 30 |
|
@@ -1062,6 +1064,29 @@ def testNewUserAuthor(self): |
1062 | 1064 | m.sort() |
1063 | 1065 | self.assertNotEqual(l, m) |
1064 | 1066 |
|
| 1067 | + def testNewUserAuthorHighBit(self): |
| 1068 | + l = set(self.db.user.list()) |
| 1069 | + # From: name has Euro symbol in it |
| 1070 | + message = '''Content-Type: text/plain; |
| 1071 | + charset="iso-8859-1" |
| 1072 | +From: =?utf8?b?SOKCrGxsbw==?= <[email protected]> |
| 1073 | + |
| 1074 | +Message-Id: <dummy_test_message_id> |
| 1075 | +Subject: [issue] Testing... |
| 1076 | +
|
| 1077 | +This is a test submission of a new issue. |
| 1078 | +''' |
| 1079 | + p = [ |
| 1080 | + self.db.security.getPermission('Create', 'user'), |
| 1081 | + self.db.security.getPermission('Email Access', None), |
| 1082 | + ] |
| 1083 | + self.db.security.role['anonymous'].permissions=p |
| 1084 | + self._handle_mail(message) |
| 1085 | + m = set(self.db.user.list()) |
| 1086 | + new = list(m - l)[0] |
| 1087 | + name = self.db.user.get(new, 'realname') |
| 1088 | + self.assertEquals(name, 'H€llo') |
| 1089 | + |
1065 | 1090 | def testEnc01(self): |
1066 | 1091 | self.doNewIssue() |
1067 | 1092 | self._handle_mail('''Content-Type: text/plain; |
@@ -1102,6 +1127,53 @@ def testEnc01(self): |
1102 | 1127 | ---------- |
1103 | 1128 | status: unread -> chatting |
1104 | 1129 |
|
| 1130 | +_______________________________________________________________________ |
| 1131 | +Roundup issue tracker <[email protected]> |
| 1132 | +<http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1> |
| 1133 | +_______________________________________________________________________ |
| 1134 | +''') |
| 1135 | + |
| 1136 | + def testEncNonUTF8(self): |
| 1137 | + self.doNewIssue() |
| 1138 | + self.instance.config.EMAIL_CHARSET = 'iso-8859-1' |
| 1139 | + self._handle_mail('''Content-Type: text/plain; |
| 1140 | + charset="iso-8859-1" |
| 1141 | + |
| 1142 | + |
| 1143 | +Message-Id: <followup_dummy_id> |
| 1144 | +In-Reply-To: <dummy_test_message_id> |
| 1145 | +Subject: [issue1] Testing... |
| 1146 | +Content-Type: text/plain; |
| 1147 | + charset="iso-8859-1" |
| 1148 | +Content-Transfer-Encoding: quoted-printable |
| 1149 | +
|
| 1150 | +A message with encoding (encoded oe =F6) |
| 1151 | +
|
| 1152 | +''') |
| 1153 | + self.compareMessages(self._get_mail(), |
| 1154 | + |
| 1155 | + |
| 1156 | +Content-Type: text/plain; charset="iso-8859-1" |
| 1157 | +Subject: [issue1] Testing... |
| 1158 | + |
| 1159 | +From: "Contrary, Mary" <[email protected]> |
| 1160 | +Reply-To: Roundup issue tracker <[email protected]> |
| 1161 | +MIME-Version: 1.0 |
| 1162 | +Message-Id: <followup_dummy_id> |
| 1163 | +In-Reply-To: <dummy_test_message_id> |
| 1164 | +X-Roundup-Name: Roundup issue tracker |
| 1165 | +X-Roundup-Loop: hello |
| 1166 | +X-Roundup-Issue-Status: chatting |
| 1167 | +Content-Transfer-Encoding: quoted-printable |
| 1168 | +
|
| 1169 | +
|
| 1170 | +Contrary, Mary <[email protected]> added the comment: |
| 1171 | +
|
| 1172 | +A message with encoding (encoded oe =F6) |
| 1173 | +
|
| 1174 | +---------- |
| 1175 | +status: unread -> chatting |
| 1176 | +
|
1105 | 1177 | _______________________________________________________________________ |
1106 | 1178 | Roundup issue tracker <[email protected]> |
1107 | 1179 | <http://tracker.example/cgi-bin/roundup.cgi/bugs/issue1> |
|
0 commit comments