Changeset 11585 for main/waeup.kofa/trunk/src/waeup/kofa/tests
- Timestamp:
- 10 Apr 2014, 12:57:45 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/tests/test_smtp.py
r10855 r11585 56 56 # 57 57 58 58 59 def external_mail_test(func): 59 60 if not EXTERNAL_MAIL_TESTS: … … 65 66 return 66 67 return func 68 67 69 68 70 class HelperTests(unittest.TestCase): … … 86 88 # we can correctly encode address parts 87 89 result1 = encode_address('foo@bar.baz') 88 result2 = encode_address(u'foo@bar.baz', 'The Foo' 90 result2 = encode_address(u'foo@bar.baz', 'The Foo') 89 91 result3 = encode_address('foo@bar.baz', u'The Foo') 90 92 result4 = encode_address('foo@bar.baz', u'With Umläut') … … 141 143 # they contain chars unrepresentable in ascii but available in latin1 142 144 text = u"Simple text with ü and capital pi: " + unichr(0x3a0) 143 text = text.encode('utf-8') # turn unicode into byte stream145 text = text.encode('utf-8') # turn unicode into byte stream 144 146 result1 = encode_body(text) 145 147 result1 = str(result1).split('\n')[1:] … … 173 175 u"Simple text with ü and capital pi: " + unichr(0x3a0)) 174 176 return 177 175 178 176 179 class FunctionalMailerTests(FunctionalTestCase): … … 233 236 self.assertEqual( 234 237 self.get_fake_smtp_output().split('\n'), 235 [u'Sending email from sender@example.com to recpt@example.com, sender@example.com:', 238 [u'Sending email from sender@example.com to ' 239 u'recpt@example.com, sender@example.com:', 236 240 u'Message:', 237 241 u'msg: MIME-Version: 1.0', 238 242 u'msg: Content-Type: text/plain; charset="us-ascii"', 239 243 u'msg: Content-Transfer-Encoding: 7bit', 240 u'msg: From: A sender <sender@example.com>', 244 u'msg: From: A sender <no-reply@waeup.org>', 245 u'msg: To: A recipient <recpt@example.com>', 241 246 u'msg: Cc: A sender <sender@example.com>', 242 u'msg: To: A recipient <recpt@example.com>',247 u'msg: Reply-To: A sender <sender@example.com>', 243 248 u'msg: Subject: A subject', 244 249 u'msg: ', … … 258 263 self.assertEqual( 259 264 self.get_fake_smtp_output().split('\n'), 260 [u'Sending email from sender@example.com to recpt@example.com, sender@example.com:', 265 [u'Sending email from sender@example.com ' 266 u'to recpt@example.com, sender@example.com:', 261 267 u'Message:', u'msg: MIME-Version: 1.0', 262 268 u'msg: Content-Type: text/plain; charset="iso-8859-1"', 263 269 u'msg: Content-Transfer-Encoding: quoted-printable', 264 u'msg: From: A sender <sender@example.com>', 270 u'msg: From: A sender <no-reply@waeup.org>', 271 u'msg: To: A recipient <recpt@example.com>', 265 272 u'msg: Cc: A sender <sender@example.com>', 266 u'msg: To: A recipient <recpt@example.com>',273 u'msg: Reply-To: A sender <sender@example.com>', 267 274 u'msg: Subject: A subject', 268 275 u'msg: ', … … 282 289 self.assertEqual( 283 290 self.get_fake_smtp_output().split('\n'), 284 [u'Sending email from sender@example.com to recpt@example.com, sender@example.com:', 291 [u'Sending email from sender@example.com ' 292 u'to recpt@example.com, sender@example.com:', 285 293 u'Message:', u'msg: MIME-Version: 1.0', 286 294 u'msg: Content-Type: text/plain; charset="iso-8859-1"', 287 295 u'msg: Content-Transfer-Encoding: quoted-printable', 288 u'msg: From: A sender <sender@example.com>', 296 u'msg: From: A sender <no-reply@waeup.org>', 297 u'msg: To: A recipient <recpt@example.com>', 289 298 u'msg: Cc: A sender <sender@example.com>', 290 u'msg: To: A recipient <recpt@example.com>',299 u'msg: Reply-To: A sender <sender@example.com>', 291 300 u'msg: Subject: A subject', 292 301 u'msg: ', … … 337 346 ) 338 347 import transaction 339 transaction.commit() # The mail is really sent when transactions is340 # committed348 transaction.commit() # The mail is really sent when transactions is 349 # committed 341 350 self.assertTrue('@' in result) 342 351 return … … 355 364 ) 356 365 import transaction 357 transaction.commit() # The mail is really sent when transactions is358 # committed366 transaction.commit() # The mail is really sent when transactions is 367 # committed 359 368 self.assertTrue('@' in result) 360 369 return … … 372 381 ) 373 382 import transaction 374 transaction.commit() # The mail is really sent when transactions is375 # committed383 transaction.commit() # The mail is really sent when transactions is 384 # committed 376 385 self.assertTrue('@' in result) 377 386 return
Note: See TracChangeset for help on using the changeset viewer.