|
@@ -26,7 +26,9 @@ class APITestCase(TestCase):
|
|
|
class TestContrib(TestCase):
|
|
|
def test_comma_separatedcharfield(self):
|
|
|
co = Contrib(name='foo', orientations=['SO', 'NE'],
|
|
|
- contrib_type=Contrib.CONTRIB_CONNECT)
|
|
|
+ contrib_type=Contrib.CONTRIB_CONNECT,
|
|
|
+ latitude=0.5, longitude=0.5,
|
|
|
+)
|
|
|
co.save()
|
|
|
self.assertEqual(
|
|
|
Contrib.objects.get(name='foo').orientations,
|
|
@@ -41,6 +43,8 @@ class TestContribPrivacy(TestCase):
|
|
|
name='John',
|
|
|
phone='010101010101',
|
|
|
contrib_type=Contrib.CONTRIB_CONNECT,
|
|
|
+ latitude=0.5,
|
|
|
+ longitude=0.5,
|
|
|
)
|
|
|
self.assertEqual(c.get_public_field('phone'), None)
|
|
|
|
|
@@ -50,6 +54,8 @@ class TestContribPrivacy(TestCase):
|
|
|
phone='010101010101',
|
|
|
contrib_type=Contrib.CONTRIB_CONNECT,
|
|
|
privacy_name=True,
|
|
|
+ latitude=0.5,
|
|
|
+ longitude=0.5,
|
|
|
)
|
|
|
self.assertEqual(c.get_public_field('name'), 'John')
|
|
|
|
|
@@ -60,6 +66,8 @@ class TestContribPrivacy(TestCase):
|
|
|
orientations=['N'],
|
|
|
contrib_type=Contrib.CONTRIB_CONNECT,
|
|
|
privacy_name=True,
|
|
|
+ latitude=0.5,
|
|
|
+ longitude=0.5,
|
|
|
)
|
|
|
self.assertEqual(c.get_public_field('angles'), [[-23, 22]])
|
|
|
|
|
@@ -68,6 +76,8 @@ class TestContribPrivacy(TestCase):
|
|
|
name='John',
|
|
|
phone='010101010101',
|
|
|
contrib_type=Contrib.CONTRIB_CONNECT,
|
|
|
+ latitude=0.5,
|
|
|
+ longitude=0.5,
|
|
|
)
|
|
|
self.assertEqual(c.privacy_name, False)
|
|
|
self.assertEqual(c.get_public_field('name'), None)
|
|
@@ -83,7 +93,9 @@ class TestViews(APITestCase):
|
|
|
name='John',
|
|
|
phone='010101010101',
|
|
|
contrib_type=Contrib.CONTRIB_CONNECT,
|
|
|
- privacy_coordinates=False,
|
|
|
+ privacy_coordinates=True,
|
|
|
+ latitude=0.5,
|
|
|
+ longitude=0.5,
|
|
|
)
|
|
|
response = self.client.json_get('/map/public.json')
|
|
|
self.assertEqual(response.status_code, 200)
|