comparison email_list/tests/test_views.py @ 180:312f198e8958

Changes for Django 1.8.
author Brian Neal <bgneal@gmail.com>
date Sun, 13 Dec 2015 21:04:43 -0600
parents 3062c547bb90
children
comparison
equal deleted inserted replaced
179:574cdd0241af 180:312f198e8958
1 """ 1 """
2 View tests for the email_list application. 2 View tests for the email_list application.
3 3
4 """ 4 """
5 import urllib
6
7 from django.test import TestCase 5 from django.test import TestCase
8 from django.core.urlresolvers import reverse 6 from django.core.urlresolvers import reverse
9 from django.core import mail 7 from django.core import mail
10 8
11 from email_list.models import Subscriber 9 from email_list.models import Subscriber
209 self.assertEqual(len(mail.outbox), 1) 207 self.assertEqual(len(mail.outbox), 1)
210 self.assertEqual(len(mail.outbox[0].to), 1) 208 self.assertEqual(len(mail.outbox[0].to), 1)
211 self.assertEqual(mail.outbox[0].to[0], subscriber.email) 209 self.assertEqual(mail.outbox[0].to[0], subscriber.email)
212 210
213 msg = str(mail.outbox[0].message()) 211 msg = str(mail.outbox[0].message())
214 self.assertTrue(msg.count(urllib.quote(subscriber.key)) > 0) 212 self.assertTrue(msg.count(subscriber.key) > 0)
215 213
216 # clear outbox 214 # clear outbox
217 mail.outbox = [] 215 mail.outbox = []