summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2013-02-11 02:39:14 -0500
committerSimon Charette <charette.s@gmail.com>2013-02-11 02:39:14 -0500
commita10f3908042a71ec5ef81bf76f0f278ca5e7a596 (patch)
tree879bf91f6b9e6419b06ebc9b0bd6b739a7b99105 /tests
parent5ce6a7cea25ac8e616fa6bd132ee341a240aad6f (diff)
Fixed #19044 -- Made `DeletionMixin` interpolate its `success_url`.
Thanks to nxvl and slurms for the initial patch, ptone for the review and timo for the documentation tweaks.
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/generic_views/edit.py19
-rw-r--r--tests/regressiontests/generic_views/urls.py2
2 files changed, 15 insertions, 6 deletions
diff --git a/tests/regressiontests/generic_views/edit.py b/tests/regressiontests/generic_views/edit.py
index 0f1eb3cca7..3bacc31ee2 100644
--- a/tests/regressiontests/generic_views/edit.py
+++ b/tests/regressiontests/generic_views/edit.py
@@ -13,12 +13,12 @@ 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)
+ 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 BasicFormTests(TestCase):
@@ -283,6 +283,13 @@ class DeleteViewTests(TestCase):
self.assertRedirects(res, 'http://testserver/edit/authors/create/')
self.assertQuerysetEqual(Author.objects.all(), [])
+ def test_delete_with_interpolated_redirect(self):
+ a = Author.objects.create(**{'name': 'Randall Munroe', 'slug': 'randall-munroe'})
+ res = self.client.post('/edit/author/%d/delete/interpolate_redirect/' % a.pk)
+ self.assertEqual(res.status_code, 302)
+ self.assertRedirects(res, 'http://testserver/edit/authors/create/?deleted=%d' % a.pk)
+ self.assertQuerysetEqual(Author.objects.all(), [])
+
def test_delete_with_special_properties(self):
a = Author.objects.create(**{'name': 'Randall Munroe', 'slug': 'randall-munroe'})
res = self.client.get('/edit/author/%d/delete/special/' % a.pk)
diff --git a/tests/regressiontests/generic_views/urls.py b/tests/regressiontests/generic_views/urls.py
index 57309053d3..695b50279a 100644
--- a/tests/regressiontests/generic_views/urls.py
+++ b/tests/regressiontests/generic_views/urls.py
@@ -97,6 +97,8 @@ urlpatterns = patterns('',
views.NaiveAuthorDelete.as_view()),
(r'^edit/author/(?P<pk>\d+)/delete/redirect/$',
views.NaiveAuthorDelete.as_view(success_url='/edit/authors/create/')),
+ (r'^edit/author/(?P<pk>\d+)/delete/interpolate_redirect/$',
+ views.NaiveAuthorDelete.as_view(success_url='/edit/authors/create/?deleted=%(id)s')),
(r'^edit/author/(?P<pk>\d+)/delete/$',
views.AuthorDelete.as_view()),
(r'^edit/author/(?P<pk>\d+)/delete/special/$',