1
0
mirror of https://github.com/django/django.git synced 2025-01-07 00:46:08 +00:00
django/tests/flatpages_tests/test_models.py
Bas Peschier 0339844b70 Fixed #24476 -- Added context manager/decorator for overriding script prefix.
Tests were using an undocumented keyword argument for easily overriding
script prefix while reversing. This is now changed into a test utility
which can be used as decorator or context manager.
2015-03-18 13:03:25 -04:00

20 lines
626 B
Python

# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib.flatpages.models import FlatPage
from django.test import TestCase
from django.test.utils import override_script_prefix
class FlatpageModelTests(TestCase):
def test_get_absolute_url_urlencodes(self):
pf = FlatPage(title="Café!", url='/café/')
self.assertEqual(pf.get_absolute_url(), '/caf%C3%A9/')
@override_script_prefix('/beverages/')
def test_get_absolute_url_honors_script_prefix(self):
pf = FlatPage(title="Tea!", url='/tea/')
self.assertEqual(pf.get_absolute_url(), '/beverages/tea/')