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 21:13:50 -0400
commitb1aea89dee4598857aaa3847f996e7cd03316a10 (patch)
treef1e35df043673e8bd694456332c904eb1c6d2769 /tests
parenta2975cb083a01012eb0cb997f0f5b7c2263cfbba (diff)
[1.11.x] Fixed #28105 -- Fixed crash in BaseGeometryWidget.get_context() when overriding existing attrs.
Backport of 75aeebebfe3df3ea46b8e12dd5e7719f98664d3a from master
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 7bec54edf5..26a08904b3 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(