From bd8deeccd5ac14ee6b6aaef3700f9f9e15ca2c78 Mon Sep 17 00:00:00 2001 From: Mads Jensen Date: Wed, 11 Oct 2017 21:27:15 +0200 Subject: [PATCH] Added setUp() method to FlatpageModelTests. --- tests/flatpages_tests/test_models.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/flatpages_tests/test_models.py b/tests/flatpages_tests/test_models.py index 19d61cfff7..dd4581312a 100644 --- a/tests/flatpages_tests/test_models.py +++ b/tests/flatpages_tests/test_models.py @@ -5,11 +5,12 @@ from django.test.utils import override_script_prefix class FlatpageModelTests(SimpleTestCase): - def test_get_absolute_url_urlencodes(self): - pf = FlatPage(title="Café!", url='/café/') - self.assertEqual(pf.get_absolute_url(), '/caf%C3%A9/') + def setUp(self): + self.page = FlatPage(title='Café!', url='/café/') - @override_script_prefix('/beverages/') + def test_get_absolute_url_urlencodes(self): + self.assertEqual(self.page.get_absolute_url(), '/caf%C3%A9/') + + @override_script_prefix('/prefix/') def test_get_absolute_url_honors_script_prefix(self): - pf = FlatPage(title="Tea!", url='/tea/') - self.assertEqual(pf.get_absolute_url(), '/beverages/tea/') + self.assertEqual(self.page.get_absolute_url(), '/prefix/caf%C3%A9/')