Skip to content

Commit

Permalink
Fix tests for Django 1.11: Point comparison uses srid
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed May 20, 2017
1 parent eb54fc0 commit 33a6418
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tests/django_restframework_gis_tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,8 @@ def test_patch_geojson_location(self):
self.assertEqual(response.status_code, 200)
location_reloaded = Location.objects.get(pk=location.id)
self.assertEquals(location_reloaded.name, 'geojson successful patch test')
self.assertEquals(location_reloaded.geometry, Point(10.1, 10.1))
self.assertEquals(location_reloaded.geometry,
Point(10.1, 10.1, srid=location.geometry.srid))

def test_patch_geojson_location_wo_changing_geometry(self):
location = Location.objects.create(name='geojson patch test', geometry='POINT (135.0 45.0)')
Expand All @@ -501,13 +502,15 @@ def test_patch_geojson_location_wo_changing_geometry(self):
self.assertEqual(response.status_code, 200)
location_reloaded = Location.objects.get(pk=location.id)
self.assertEquals(location_reloaded.name, 'geojson successful patch test')
self.assertEquals(location_reloaded.geometry, Point(135.0, 45.0))
self.assertEquals(location_reloaded.geometry,
Point(135.0, 45.0, srid=location.geometry.srid))

def test_geometry_serializer_method_field(self):
location = Location.objects.create(name='geometry serializer method test', geometry='POINT (135.0 45.0)')
location_loaded = Location.objects.get(pk=location.id)
self.assertEqual(location_loaded.name, 'geometry serializer method test')
self.assertEqual(location_loaded.geometry, Point(135.0, 45.0))
self.assertEqual(location_loaded.geometry,
Point(135.0, 45.0, srid=location.geometry.srid))
url = reverse('api_geojson_location_details_hidden', args=[location.id])
data = {
"properties": {
Expand All @@ -523,7 +526,8 @@ def test_geometry_serializer_method_field(self):
def test_geometry_serializer_method_field_none(self):
location = Location.objects.create(name='None value', geometry='POINT (135.0 45.0)')
location_loaded = Location.objects.get(pk=location.id)
self.assertEqual(location_loaded.geometry, Point(135.0, 45.0))
self.assertEqual(location_loaded.geometry,
Point(135.0, 45.0, srid=location.geometry.srid))
url = reverse('api_geojson_location_details_none', args=[location.id])
response = self.client.generic('GET', url, content_type='application/json')
self.assertEqual(response.status_code, 200)
Expand Down

0 comments on commit 33a6418

Please sign in to comment.