summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDylan Verheul <dylan@zostera.nl>2017-04-29 15:35:46 +0200
committerTim Graham <timograham@gmail.com>2017-04-30 20:19:12 -0400
commit75aeebebfe3df3ea46b8e12dd5e7719f98664d3a (patch)
tree4a70867e318909b82b182d89ed851a8b7036b3d0 /tests
parent1ebd295082bb0e6b230cf3bc39fd04bee71c2bd7 (diff)
Fixed #28105 -- Fixed crash in BaseGeometryWidget.get_context() when overriding existing attrs.
Diffstat (limited to 'tests')
-rw-r--r--tests/gis_tests/test_geoforms.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/gis_tests/test_geoforms.py b/tests/gis_tests/test_geoforms.py
index 73521bc2e6..91bfc173f5 100644
--- a/tests/gis_tests/test_geoforms.py
+++ b/tests/gis_tests/test_geoforms.py
@@ -1,6 +1,7 @@
import re
from django.contrib.gis import forms
+from django.contrib.gis.forms import BaseGeometryWidget
from django.contrib.gis.geos import GEOSGeometry
from django.forms import ValidationError
from django.test import SimpleTestCase, override_settings, skipUnlessDBFeature
@@ -353,6 +354,12 @@ class OSMWidgetTest(SimpleTestCase):
@skipUnlessDBFeature("gis_enabled")
class GeometryWidgetTests(SimpleTestCase):
+ def test_get_context_attrs(self):
+ """The Widget.get_context() attrs argument overrides self.attrs."""
+ widget = BaseGeometryWidget(attrs={'geom_type': 'POINT'})
+ context = widget.get_context('point', None, attrs={'geom_type': 'POINT2'})
+ self.assertEqual(context['geom_type'], 'POINT2')
+
def test_subwidgets(self):
widget = forms.BaseGeometryWidget()
self.assertEqual(