Permalink
Browse files

Increased django.utils.translation.trans_null test coverage.

  • Loading branch information...
hramezani authored and timgraham committed May 10, 2018
1 parent ac59ec8 commit 305dee7bf979ed3a9e2ce7507a37a6fc484e5263
Showing with 15 additions and 0 deletions.
  1. +15 −0 tests/i18n/tests.py
View
@@ -297,6 +297,11 @@ def test_language_bidi(self):
with translation.override(None):
self.assertIs(get_language_bidi(), False)
+ def test_language_bidi_null(self):
+ self.assertIs(trans_null.get_language_bidi(), False)
+ with override_settings(LANGUAGE_CODE='he'):
+ self.assertIs(get_language_bidi(), True)
+
class TranslationThreadSafetyTests(SimpleTestCase):
@@ -1649,6 +1654,9 @@ def test_check_for_language(self):
self.assertFalse(check_for_language('tr-TR.UTF8'))
self.assertFalse(check_for_language('de-DE.utf-8'))
+ def test_check_for_language_null(self):
+ self.assertIs(trans_null.check_for_language('en'), True)
+
def test_get_language_from_request(self):
# issue 19919
r = self.rf.get('/')
@@ -1662,6 +1670,13 @@ def test_get_language_from_request(self):
lang = get_language_from_request(r)
self.assertEqual('bg', lang)
+ def test_get_language_from_request_null(self):
+ lang = trans_null.get_language_from_request(None)
+ self.assertEqual(lang, 'en')
+ with override_settings(LANGUAGE_CODE='de'):
+ lang = trans_null.get_language_from_request(None)
+ self.assertEqual(lang, 'de')
+
def test_specific_language_codes(self):
# issue 11915
r = self.rf.get('/')

0 comments on commit 305dee7

Please sign in to comment.