|
@@ -26,6 +26,8 @@ class APITestCase(TestCase):
|
|
|
class TestContrib(TestCase):
|
|
|
def test_comma_separatedcharfield(self):
|
|
|
co = Contrib(name='foo', orientations=['SO', 'NE'],
|
|
|
+ latitude=47.218371,
|
|
|
+ longitude=-1.553621,
|
|
|
contrib_type=Contrib.CONTRIB_CONNECT)
|
|
|
co.save()
|
|
|
self.assertEqual(
|
|
@@ -40,6 +42,8 @@ class TestContribPrivacy(TestCase):
|
|
|
c = Contrib.objects.create(
|
|
|
name='John',
|
|
|
phone='010101010101',
|
|
|
+ latitude=47.218371,
|
|
|
+ longitude=-1.553621,
|
|
|
contrib_type=Contrib.CONTRIB_CONNECT,
|
|
|
)
|
|
|
self.assertEqual(c.get_public_field('phone'), None)
|
|
@@ -48,6 +52,8 @@ class TestContribPrivacy(TestCase):
|
|
|
c = Contrib.objects.create(
|
|
|
name='John',
|
|
|
phone='010101010101',
|
|
|
+ latitude=47.218371,
|
|
|
+ longitude=-1.553621,
|
|
|
contrib_type=Contrib.CONTRIB_CONNECT,
|
|
|
privacy_name=True,
|
|
|
)
|
|
@@ -58,6 +64,8 @@ class TestContribPrivacy(TestCase):
|
|
|
name='John',
|
|
|
phone='010101010101',
|
|
|
orientations=['N'],
|
|
|
+ latitude=47.218371,
|
|
|
+ longitude=-1.553621,
|
|
|
contrib_type=Contrib.CONTRIB_CONNECT,
|
|
|
privacy_name=True,
|
|
|
)
|
|
@@ -67,6 +75,8 @@ class TestContribPrivacy(TestCase):
|
|
|
c = Contrib.objects.create(
|
|
|
name='John',
|
|
|
phone='010101010101',
|
|
|
+ latitude=47.218371,
|
|
|
+ longitude=-1.553621,
|
|
|
contrib_type=Contrib.CONTRIB_CONNECT,
|
|
|
)
|
|
|
self.assertEqual(c.privacy_name, False)
|
|
@@ -82,6 +92,8 @@ class TestViews(APITestCase):
|
|
|
Contrib.objects.create(
|
|
|
name='John',
|
|
|
phone='010101010101',
|
|
|
+ latitude=47.218371,
|
|
|
+ longitude=-1.553621,
|
|
|
contrib_type=Contrib.CONTRIB_CONNECT,
|
|
|
privacy_coordinates=False,
|
|
|
)
|
|
@@ -133,6 +145,35 @@ class TestViews(APITestCase):
|
|
|
self.assertIn('JohnCleese', mail.outbox[0].subject)
|
|
|
self.assertIn('JohnCleese', mail.outbox[0].body)
|
|
|
|
|
|
+ @override_settings(NOTIFICATION_EMAILS=['foo@example.com'])
|
|
|
+ def test_add_contrib_like_a_robot(self):
|
|
|
+ response = self.client.post('/map/contribute', {
|
|
|
+ 'roof': True,
|
|
|
+ 'human_field': 'should not have no value',
|
|
|
+ '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',
|
|
|
+ })
|
|
|
+ self.assertEqual(response.status_code, 403)
|
|
|
+ self.assertEqual(len(mail.outbox), 0)
|
|
|
+
|
|
|
class TestForms(TestCase):
|
|
|
valid_data = {
|
|
|
'roof': True,
|