diff --git a/tests/django_restframework_gis_tests/admin.py b/tests/django_restframework_gis_tests/admin.py index b6622900..8a7b5756 100644 --- a/tests/django_restframework_gis_tests/admin.py +++ b/tests/django_restframework_gis_tests/admin.py @@ -4,8 +4,6 @@ from .models import Location +@admin.register(Location) class LocationAdmin(GeoModelAdmin): list_display = ('name', 'geometry') - - -admin.site.register(Location, LocationAdmin) diff --git a/tests/django_restframework_gis_tests/tests.py b/tests/django_restframework_gis_tests/tests.py index 38665b38..6c36b37f 100644 --- a/tests/django_restframework_gis_tests/tests.py +++ b/tests/django_restframework_gis_tests/tests.py @@ -133,7 +133,7 @@ def test_post_HTML_browsable_api(self): ), } response = self.client.post( - self.location_list_url, data, HTTP_ACCEPT='text/html' + self.location_list_url, data, headers={"accept": 'text/html'} ) self.assertEqual(response.status_code, 201) self.assertEqual(Location.objects.count(), 1) @@ -289,7 +289,7 @@ def test_geojson_format(self): self.assertCountEqual(json.dumps(response.data), json.dumps(expected)) else: self.assertItemsEqual(json.dumps(response.data), json.dumps(expected)) - response = self.client.get(url, HTTP_ACCEPT='text/html') + response = self.client.get(url, headers={"accept": 'text/html'}) self.assertContains(response, "Kool geojson test") def test_geojson_id_attribute(self): @@ -391,7 +391,7 @@ def test_post_geojson_location_list_HTML(self): self.geojson_location_list_url, data=json.dumps(data), content_type='application/json', - HTTP_ACCEPT='text/html', + headers={"accept": 'text/html'}, ) self.assertEqual(response.status_code, 201) self.assertEqual(Location.objects.count(), 1) @@ -495,12 +495,12 @@ def test_geofeatured_model_post_as_multipartformdata(self): def test_HTML_browsable_geojson_location_list(self): response = self.client.get( - self.geojson_location_list_url, HTTP_ACCEPT='text/html' + self.geojson_location_list_url, headers={"accept": 'text/html'} ) self.assertEqual(response.status_code, 200) self._create_locations() response = self.client.get( - self.geojson_location_list_url, HTTP_ACCEPT='text/html' + self.geojson_location_list_url, headers={"accept": 'text/html'} ) self.assertContains(response, 'l1') self.assertContains(response, 'l2') @@ -512,7 +512,7 @@ def test_post_geojson_location_list_HTML_web_form(self): "geometry": json.dumps({"type": "Point", "coordinates": [10.1, 10.1]}), } response = self.client.post( - self.geojson_location_list_url, data, HTTP_ACCEPT='text/html' + self.geojson_location_list_url, data, headers={"accept": 'text/html'} ) self.assertEqual(response.status_code, 201) self.assertEqual(Location.objects.count(), 1) @@ -524,7 +524,7 @@ def test_post_geojson_location_list_HTML_web_form_WKT(self): self.assertEqual(Location.objects.count(), 0) data = {"name": "HTML test WKT", "geometry": "POINT (10.1 10.1)"} response = self.client.post( - self.geojson_location_list_url, data, HTTP_ACCEPT='text/html' + self.geojson_location_list_url, data, headers={"accept": 'text/html'} ) self.assertEqual(response.status_code, 201) self.assertEqual(Location.objects.count(), 1) @@ -535,7 +535,7 @@ def test_post_geojson_location_list_HTML_web_form_WKT(self): def test_geojson_HTML_widget_value(self): self._create_locations() response = self.client.get( - self.geojson_location_list_url, HTTP_ACCEPT='text/html' + self.geojson_location_list_url, headers={"accept": 'text/html'} ) self.assertContains(response, '