Permalink
Browse files

2.5 tests

  • Loading branch information...
1 parent 08af07f commit f0d9b04d72953339f3992d585d6a7953dcee3455 @danjac danjac committed Feb 11, 2011
Showing with 11 additions and 3 deletions.
  1. +11 −3 pyramid_mailer/tests.py
@@ -366,8 +366,12 @@ def test_use_ssl_mailer(self):
def test_from_settings(self):
- from smtplib import SMTP_SSL
-
+ try:
+ from smtplib import SMTP_SSL
+ ssl_enabled = True
+ except ImportError:
+ from smtplib import SMTP
+ ssl_enabled = False
from pyramid_mailer.mailer import Mailer
settings = {'mymail.host' : 'my.server.com',
@@ -388,7 +392,11 @@ def test_from_settings(self):
self.assert_(mailer.direct_delivery.mailer.username=='tester')
self.assert_(mailer.direct_delivery.mailer.password=='test')
self.assert_(mailer.direct_delivery.mailer.force_tls==True)
- self.assert_(mailer.direct_delivery.mailer.smtp == SMTP_SSL)
+ if ssl_enabled:
+ self.assert_(mailer.direct_delivery.mailer.smtp == SMTP_SSL)
+ else:
+ self.assert_(mailer.direct_delivery.mailer.smtp == SMTP)
+
self.assert_(mailer.direct_delivery.mailer.keyfile == 'ssl.key')
self.assert_(mailer.direct_delivery.mailer.certfile == 'ssl.crt')
self.assert_(mailer.queue_delivery.queuePath == '/tmp')

0 comments on commit f0d9b04

Please sign in to comment.