1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Added setUp() method to FlatpageModelTests.

This commit is contained in:
Mads Jensen 2017-10-11 21:27:15 +02:00 committed by Tim Graham
parent 41be85862d
commit bd8deeccd5

View File

@ -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/')