|
@@ -84,6 +84,26 @@ class TestContribPrivacy(TestCase):
|
|
|
|
|
|
|
|
|
class TestViews(APITestCase):
|
|
|
+ def mk_contrib_post_data(self, *args, **kwargs):
|
|
|
+ post_data = {
|
|
|
+ 'roof': True,
|
|
|
+ 'privacy_place_details': True,
|
|
|
+ 'privacy_coordinates': True,
|
|
|
+ 'phone': '0202020202',
|
|
|
+ 'orientations': ('N', 'NO', 'O', 'SO', 'S', 'SE', 'E', 'NE'),
|
|
|
+ 'orientation': 'all',
|
|
|
+ 'name': 'JohnCleese',
|
|
|
+ 'longitude': -1.553621,
|
|
|
+ 'latitude': 47.218371,
|
|
|
+ 'floor_total': '2',
|
|
|
+ 'floor': 1,
|
|
|
+ 'email': 'coucou@example.com',
|
|
|
+ 'contrib_type': 'connect',
|
|
|
+ 'connect_local': 'on',
|
|
|
+ }
|
|
|
+ post_data.update(kwargs)
|
|
|
+ return post_data
|
|
|
+
|
|
|
def test_public_json(self):
|
|
|
response = self.client.json_get('/map/public.json')
|
|
|
self.assertEqual(response.status_code, 200)
|
|
@@ -115,37 +135,17 @@ class TestViews(APITestCase):
|
|
|
self.assertEqual(response.status_code, 200)
|
|
|
|
|
|
@override_settings(NOTIFICATION_EMAILS=['foo@example.com'])
|
|
|
- def test_add_contrib_sends_email(self):
|
|
|
- response = self.client.post('/map/contribute', {
|
|
|
- 'roof': True,
|
|
|
- 'privacy_place_details': True,
|
|
|
- 'privacy_coordinates': True,
|
|
|
- 'phone': '0202020202',
|
|
|
- 'orientations': 'N',
|
|
|
- 'orientations': 'NO',
|
|
|
- 'orientations': 'O',
|
|
|
- 'orientations': 'SO',
|
|
|
- 'orientations': 'S',
|
|
|
- 'orientations': 'SE',
|
|
|
- 'orientations': 'E',
|
|
|
- 'orientations': 'NE',
|
|
|
- 'orientation': 'all',
|
|
|
- 'name': 'JohnCleese',
|
|
|
- 'longitude': -1.553621,
|
|
|
- 'latitude': 47.218371,
|
|
|
- 'floor_total': '2',
|
|
|
- 'floor': 1,
|
|
|
- 'email': 'coucou@example.com',
|
|
|
- 'contrib_type': 'connect',
|
|
|
- 'connect_local': 'on',
|
|
|
- })
|
|
|
+ def test_add_contrib_sends_moderator_email(self):
|
|
|
+ post_data = self.mk_contrib_post_data({'name': 'JohnCleese'})
|
|
|
+ del post_data['email']
|
|
|
+
|
|
|
+ response = self.client.post('/map/contribute', post_data)
|
|
|
self.assertEqual(response.status_code, 302)
|
|
|
|
|
|
self.assertEqual(len(mail.outbox), 1)
|
|
|
self.assertIn('JohnCleese', mail.outbox[0].subject)
|
|
|
self.assertIn('JohnCleese', mail.outbox[0].body)
|
|
|
|
|
|
-<<<<<<< HEAD
|
|
|
class TestForms(TestCase):
|
|
|
valid_data = {
|
|
|
'roof': True,
|