Beispiel #1
0
    def test_invalid_language(self, lang: str):
        lang = lang.replace('\x00', '')
        if lang == 'en' or lang == 'de':
            return

        request = construct_dummy_request(json_body={'lang': lang})
        self.assertFalse(valid_language(request))
        self.assertNotIn('lang', request.validated)
Beispiel #2
0
 def test_valid_english_language(self):
     request = construct_dummy_request(json_body={'lang': 'en'})
     self.assertTrue(valid_language(request))
     self.assertIn('lang', request.validated)
     self.assertEqual('en', request.validated['lang'].ui_locales)
 def test_valid_german_language(self):
     request = construct_dummy_request({'lang': 'de'})
     self.assertTrue(valid_language(request))
     self.assertIn('lang', request.validated)
     self.assertEqual('de', request.validated['lang'].ui_locales)