Browse files

Test added for language template-tag.

  • Loading branch information...
1 parent ca920f7 commit aec4e8b964e3293acb2d084e983e3051c150cf61 @brocaar committed Dec 27, 2011
Showing with 12 additions and 0 deletions.
  1. +1 −0 i18nurls/templates/i18nurls/template_tag_test.html
  2. +11 −0 i18nurls/tests/templatetags_tests.py
View
1 i18nurls/templates/i18nurls/template_tag_test.html
@@ -0,0 +1 @@
+{% load i18nurls %}{% url news %} {% language 'nl' %}{% url news %}{% endlanguage %}
View
11 i18nurls/tests/templatetags_tests.py
@@ -1,3 +1,4 @@
+from django.template.loader import render_to_string
from django.utils import translation
from i18nurls.templatetags.i18nurls import override
from i18nurls.tests.base import BaseTestCase
@@ -13,3 +14,13 @@ def test_override(self):
self.assertEqual('nl', translation.get_language())
self.assertEqual('en', translation.get_language())
+
+
+class LanguageTest(BaseTestCase):
+
+ def test_language(self):
+ translation.activate('en')
+ self.assertEqual(
+ '/en/news/ /nl/nieuws/',
+ render_to_string('i18nurls/template_tag_test.html', {})
+ )

0 comments on commit aec4e8b

Please sign in to comment.