summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2017-01-03 09:56:50 -0500
committerTim Graham <timograham@gmail.com>2017-01-03 11:11:00 -0500
commit946dd5bde2c228d6862d6ea9d0060fc0e72d5ed6 (patch)
treec557c50167aedd52dca28cb958d0baece931f7c5 /tests
parentc04207cd386e97f57e34791806fd253731295e43 (diff)
Refs #25004 -- Fixed test failure introduced by OpenLayers 3 update.
Diffstat (limited to 'tests')
-rw-r--r--tests/gis_tests/test_geoforms.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/gis_tests/test_geoforms.py b/tests/gis_tests/test_geoforms.py
index 9faf38d915..27b80ce9b2 100644
--- a/tests/gis_tests/test_geoforms.py
+++ b/tests/gis_tests/test_geoforms.py
@@ -1,3 +1,6 @@
+import json
+import re
+
from django.contrib.gis import forms
from django.contrib.gis.geos import GEOSGeometry
from django.forms import ValidationError
@@ -109,11 +112,12 @@ class GeometryFieldTest(SimpleTestCase):
with patch_logger('django.contrib.gis', 'error') as logger_calls:
output = str(form)
- self.assertInHTML(
- '<textarea id="id_pt1" class="vSerializedField required" cols="150"'
- ' rows="10" name="pt1">POINT (7.3 44)</textarea>',
- output
- )
+ # The first point can't use assertInHTML() due to non-deterministic
+ # ordering of the rendered dictionary.
+ pt1_serialized = re.search(r'<textarea [^>]*>({[^<]+})<', output).groups()[0]
+ pt1_json = json.loads(pt1_serialized.replace('&quot;', '"'))
+ self.assertEqual(pt1_json, {'coordinates': [7.3, 44.0], 'type': 'Point'})
+
self.assertInHTML(
'<textarea id="id_pt2" class="vSerializedField required" cols="150"'
' rows="10" name="pt2"></textarea>',