diff options
| author | Tim Graham <timograham@gmail.com> | 2015-02-09 19:20:39 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-02-11 11:47:58 -0500 |
| commit | 36bf6ec9eb8a3ef4e24d3a6374780603f5bbdf97 (patch) | |
| tree | aa8433e22b89b76e54d985ce601d03613d0564c3 /tests/flatpages_tests/test_models.py | |
| parent | a0553d1a7cb4f5ecca90650ef9ebad4c44cf6b43 (diff) | |
[1.8.x] Moved contrib.flatpages tests out of contrib.
Backport of d3a725054fa260e84c788b240fd03cbd0ccc1151 from master
Diffstat (limited to 'tests/flatpages_tests/test_models.py')
| -rw-r--r-- | tests/flatpages_tests/test_models.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/flatpages_tests/test_models.py b/tests/flatpages_tests/test_models.py new file mode 100644 index 0000000000..c48dc38637 --- /dev/null +++ b/tests/flatpages_tests/test_models.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- + +from __future__ import unicode_literals + +from django.contrib.flatpages.models import FlatPage +from django.core.urlresolvers import clear_script_prefix, set_script_prefix +from django.test import TestCase + + +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/') + + def test_get_absolute_url_honors_script_prefix(self): + pf = FlatPage(title="Tea!", url='/tea/') + set_script_prefix('/beverages/') + try: + self.assertEqual(pf.get_absolute_url(), '/beverages/tea/') + finally: + clear_script_prefix() |
