|
@@ -151,6 +151,24 @@ class TestViews(APITestCase):
|
|
self.assertEqual(len(mail.outbox), 1)
|
|
self.assertEqual(len(mail.outbox), 1)
|
|
self.assertIn('JohnCleese', mail.outbox[0].subject)
|
|
self.assertIn('JohnCleese', mail.outbox[0].subject)
|
|
self.assertIn('JohnCleese', mail.outbox[0].body)
|
|
self.assertIn('JohnCleese', mail.outbox[0].body)
|
|
|
|
+ self.assertEqual(mail.outbox[0].recipients(), ['foo@example.com'])
|
|
|
|
+
|
|
|
|
+ def test_add_contrib_sends_no_author_email(self):
|
|
|
|
+ # Send no email if author did not mentioned an email
|
|
|
|
+ post_data = self.mk_contrib_post_data()
|
|
|
|
+ del post_data['email']
|
|
|
|
+
|
|
|
|
+ response = self.client.post('/map/contribute', post_data)
|
|
|
|
+ self.assertEqual(response.status_code, 302)
|
|
|
|
+ self.assertEqual(len(mail.outbox), 0)
|
|
|
|
+
|
|
|
|
+ def test_add_contrib_sends_author_email(self):
|
|
|
|
+ # Send no email if author did not mentioned an email
|
|
|
|
+ response = self.client.post(
|
|
|
|
+ '/map/contribute',
|
|
|
|
+ self.mk_contrib_post_data(email='author@example.com'))
|
|
|
|
+ self.assertEqual(response.status_code, 302)
|
|
|
|
+ self.assertEqual(len(mail.outbox), 1)
|
|
|
|
|
|
|
|
|
|
class TestManageView(APITestCase):
|
|
class TestManageView(APITestCase):
|