mirror of
https://github.com/django/django.git
synced 2025-08-01 17:42:56 +00:00
Fixed #26753 -- Made GDAL a required dependency for contrib.gis
Thanks Tim Graham for the review.
This commit is contained in:
parent
7def55c3f6
commit
f7a363ee1d
29 changed files with 117 additions and 368 deletions
|
@ -1,15 +1,11 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from unittest import skipUnless
|
||||
|
||||
from django.contrib.gis import admin
|
||||
from django.contrib.gis.gdal import HAS_GDAL
|
||||
from django.contrib.gis.geos import Point
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.test import TestCase, mock, override_settings, skipUnlessDBFeature
|
||||
from django.test import TestCase, override_settings, skipUnlessDBFeature
|
||||
|
||||
from .admin import UnmodifiableAdmin
|
||||
from .models import City, CityMercator, site
|
||||
from .models import City, site
|
||||
|
||||
|
||||
@skipUnlessDBFeature("gis_enabled")
|
||||
|
@ -56,22 +52,6 @@ class GeoAdminTest(TestCase):
|
|||
""""http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic', format: 'image/jpeg'});""",
|
||||
result)
|
||||
|
||||
@mock.patch('django.contrib.gis.admin.options.HAS_GDAL', False)
|
||||
def test_no_gdal_admin_model_diffent_srid(self):
|
||||
msg = (
|
||||
'Map SRID is 3857 and SRID of `geoadmin.City.point` is 4326. '
|
||||
'GDAL must be installed to perform the transformation.'
|
||||
)
|
||||
with self.assertRaisesMessage(ImproperlyConfigured, msg):
|
||||
geoadmin = site._registry[City]
|
||||
geoadmin.get_changelist_form(None)()
|
||||
|
||||
@mock.patch('django.contrib.gis.admin.options.HAS_GDAL', False)
|
||||
def test_no_gdal_admin_model_same_srid(self):
|
||||
geoadmin = site._registry[CityMercator]
|
||||
geoadmin.get_changelist_form(None)()
|
||||
|
||||
@skipUnless(HAS_GDAL, "GDAL is required.")
|
||||
def test_olwidget_has_changed(self):
|
||||
"""
|
||||
Check that changes are accurately noticed by OpenLayersWidget.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue