diff options
| author | Claude Paroz <claude@2xlibre.net> | 2012-03-17 22:31:03 +0000 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2012-03-17 22:31:03 +0000 |
| commit | c7cc4cfb9ebef17930db4a92cd0632a536a4ff7a (patch) | |
| tree | e55dd0e148bb8247e7a1f5dec71572483050e6b5 /tests | |
| parent | f13328f7762dbdc920395bdf5c50fe0b6e40f1db (diff) | |
Fixed #16138 -- Made FormMixin get_initial return a copy of the 'initial' class variable. Thanks hanson2010, wilfred@potatolondon.com and agriffis for their work on the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17765 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/generic_views/edit.py | 9 | ||||
| -rw-r--r-- | tests/regressiontests/generic_views/tests.py | 4 |
2 files changed, 11 insertions, 2 deletions
diff --git a/tests/regressiontests/generic_views/edit.py b/tests/regressiontests/generic_views/edit.py index 2bd982e3d9..651e14fff3 100644 --- a/tests/regressiontests/generic_views/edit.py +++ b/tests/regressiontests/generic_views/edit.py @@ -5,11 +5,20 @@ from django.core.urlresolvers import reverse from django import forms from django.test import TestCase from django.utils.unittest import expectedFailure +from django.views.generic.edit import FormMixin from . import views from .models import Artist, Author +class FormMixinTests(TestCase): + def test_initial_data(self): + """ Test instance independence of initial data dict (see #16138) """ + initial_1 = FormMixin().get_initial() + initial_1['foo'] = 'bar' + initial_2 = FormMixin().get_initial() + self.assertNotEqual(initial_1, initial_2) + class ModelFormMixinTests(TestCase): def test_get_form(self): form_class = views.AuthorGetQuerySetFormView().get_form_class() diff --git a/tests/regressiontests/generic_views/tests.py b/tests/regressiontests/generic_views/tests.py index d387216d41..72aab035a8 100644 --- a/tests/regressiontests/generic_views/tests.py +++ b/tests/regressiontests/generic_views/tests.py @@ -5,6 +5,6 @@ from .dates import (ArchiveIndexViewTests, YearArchiveViewTests, MonthArchiveViewTests, WeekArchiveViewTests, DayArchiveViewTests, DateDetailViewTests) from .detail import DetailViewTest -from .edit import (ModelFormMixinTests, CreateViewTests, UpdateViewTests, - DeleteViewTests) +from .edit import (FormMixinTests, ModelFormMixinTests, CreateViewTests, + UpdateViewTests, DeleteViewTests) from .list import ListViewTests |
