diff options
Diffstat (limited to 'tests/gis_tests')
| -rw-r--r-- | tests/gis_tests/geoapp/test_serializers.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/gis_tests/geoapp/test_serializers.py b/tests/gis_tests/geoapp/test_serializers.py index 09f837417b..1bf3ec0acf 100644 --- a/tests/gis_tests/geoapp/test_serializers.py +++ b/tests/gis_tests/geoapp/test_serializers.py @@ -4,7 +4,8 @@ import json from django.contrib.gis.geos import LinearRing, Point, Polygon from django.core import serializers -from django.test import TestCase, skipUnlessDBFeature +from django.test import TestCase, mock, skipUnlessDBFeature +from django.utils import six from .models import City, MultiFields, PennsylvaniaCity @@ -70,6 +71,14 @@ class GeoJSONSerializerTests(TestCase): [int(c) for c in geodata['features'][0]['geometry']['coordinates']], [1564802, 5613214]) + @mock.patch('django.contrib.gis.serializers.geojson.HAS_GDAL', False) + def test_without_gdal(self): + # Without coordinate transformation, the serialization should succeed: + serializers.serialize('geojson', City.objects.all()) + with six.assertRaisesRegex(self, serializers.base.SerializationError, '.*GDAL is not installed'): + # Coordinate transformations need GDAL + serializers.serialize('geojson', City.objects.all(), srid=2847) + def test_deserialization_exception(self): """ GeoJSON cannot be deserialized. |
