2013-02-24 12:12:41 +00:00
|
|
|
from django.contrib.flatpages.models import FlatPage
|
2015-04-17 21:38:20 +00:00
|
|
|
from django.test import SimpleTestCase
|
2015-03-15 10:26:47 +00:00
|
|
|
from django.test.utils import override_script_prefix
|
2013-02-24 12:12:41 +00:00
|
|
|
|
|
|
|
|
2015-04-17 21:38:20 +00:00
|
|
|
class FlatpageModelTests(SimpleTestCase):
|
2013-02-24 12:12:41 +00:00
|
|
|
|
2017-10-11 19:27:15 +00:00
|
|
|
def setUp(self):
|
|
|
|
self.page = FlatPage(title='Café!', url='/café/')
|
|
|
|
|
2013-02-24 12:12:41 +00:00
|
|
|
def test_get_absolute_url_urlencodes(self):
|
2017-10-11 19:27:15 +00:00
|
|
|
self.assertEqual(self.page.get_absolute_url(), '/caf%C3%A9/')
|
2013-02-24 12:12:41 +00:00
|
|
|
|
2017-10-11 19:27:15 +00:00
|
|
|
@override_script_prefix('/prefix/')
|
2013-02-24 12:25:17 +00:00
|
|
|
def test_get_absolute_url_honors_script_prefix(self):
|
2017-10-11 19:27:15 +00:00
|
|
|
self.assertEqual(self.page.get_absolute_url(), '/prefix/caf%C3%A9/')
|