2014-05-16 01:41:55 +08:00
|
|
|
# -*- coding: utf-8 -*-
|
2013-02-24 20:12:41 +08:00
|
|
|
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
from django.contrib.flatpages.models import FlatPage
|
2015-04-18 05:38:20 +08:00
|
|
|
from django.test import SimpleTestCase
|
2015-03-15 18:26:47 +08:00
|
|
|
from django.test.utils import override_script_prefix
|
2013-02-24 20:12:41 +08:00
|
|
|
|
|
|
|
|
2015-04-18 05:38:20 +08:00
|
|
|
class FlatpageModelTests(SimpleTestCase):
|
2013-02-24 20:12:41 +08:00
|
|
|
|
|
|
|
def test_get_absolute_url_urlencodes(self):
|
|
|
|
pf = FlatPage(title="Café!", url='/café/')
|
|
|
|
self.assertEqual(pf.get_absolute_url(), '/caf%C3%A9/')
|
|
|
|
|
2015-03-15 18:26:47 +08:00
|
|
|
@override_script_prefix('/beverages/')
|
2013-02-24 20:25:17 +08:00
|
|
|
def test_get_absolute_url_honors_script_prefix(self):
|
|
|
|
pf = FlatPage(title="Tea!", url='/tea/')
|
2015-03-15 18:26:47 +08:00
|
|
|
self.assertEqual(pf.get_absolute_url(), '/beverages/tea/')
|