summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2020-01-16 14:34:54 +0100
committerGitHub <noreply@github.com>2020-01-16 14:34:54 +0100
commit266c853e10de50ce75af8be834647fda2c5fc2a0 (patch)
tree4ae7979dbd90f77e430118a4f97db166b063458a /tests
parentd08d4f464ab11cc226d4e197c0f43e26a7fd2961 (diff)
Fixed #31162 -- Prevented error logs when using WKT strings in lookups.
Thanks dbxnr for the initial patch. Regression in 6f44f714c92d2966dca390ebd3054e5fb0bb0c80.
Diffstat (limited to 'tests')
-rw-r--r--tests/gis_tests/gdal_tests/test_raster.py5
-rw-r--r--tests/gis_tests/geoapp/tests.py6
2 files changed, 11 insertions, 0 deletions
diff --git a/tests/gis_tests/gdal_tests/test_raster.py b/tests/gis_tests/gdal_tests/test_raster.py
index f3477181b4..018871efc3 100644
--- a/tests/gis_tests/gdal_tests/test_raster.py
+++ b/tests/gis_tests/gdal_tests/test_raster.py
@@ -156,6 +156,11 @@ class GDALRasterTests(SimpleTestCase):
else:
self.assertEqual(restored_raster.bands[0].data(), self.rs.bands[0].data())
+ def test_nonexistent_file(self):
+ msg = 'Unable to read raster source input "nonexistent.tif".'
+ with self.assertRaisesMessage(GDALException, msg):
+ GDALRaster('nonexistent.tif')
+
def test_vsi_raster_creation(self):
# Open a raster as a file object.
with open(self.rs_path, 'rb') as dat:
diff --git a/tests/gis_tests/geoapp/tests.py b/tests/gis_tests/geoapp/tests.py
index aab83a161a..f66e315e73 100644
--- a/tests/gis_tests/geoapp/tests.py
+++ b/tests/gis_tests/geoapp/tests.py
@@ -430,6 +430,12 @@ class GeoLookupTest(TestCase):
with self.subTest(lookup=lookup):
self.assertNotIn(null, State.objects.filter(**{'poly__%s' % lookup: geom}))
+ def test_wkt_string_in_lookup(self):
+ # Valid WKT strings don't emit error logs.
+ with self.assertRaisesMessage(AssertionError, 'no logs'):
+ with self.assertLogs('django.contrib.gis', 'ERROR'):
+ State.objects.filter(poly__intersects='LINESTRING(0 0, 1 1, 5 5)')
+
@skipUnlessDBFeature("supports_relate_lookup")
def test_relate_lookup(self):
"Testing the 'relate' lookup type."