Beispiel #1
0
 def test_models_course_run_get_languages_display_two_languages(self):
     """
     With 2 languages, it should return them joined with "them".
     """
     course_run = CourseRunFactory(languages=["fr", "en"])
     self.assertEqual(course_run.get_languages_display(),
                      "French and english")
Beispiel #2
0
 def test_models_course_run_get_languages_display_request(self):
     """
     When used in the `render_model` template tag, it should not break when passed a
     request argument (the DjangoCMS frontend editing does it).
     """
     course_run = CourseRunFactory(languages=["fr"])
     request = RequestFactory().get("/")
     self.assertEqual(course_run.get_languages_display(request), "French")
Beispiel #3
0
 def test_models_course_run_get_languages_display_three_languages(self):
     """
     With several languages, it should return a comma separated list of their readable
     version with "and" for the last one.
     """
     course_run = CourseRunFactory(languages=["fr", "en", "de"])
     self.assertEqual(course_run.get_languages_display(),
                      "French, english and german")
Beispiel #4
0
 def test_models_course_run_get_languages_display_one_language(self):
     """
     With one language, it should return its readable version without any comma.
     """
     course_run = CourseRunFactory(languages=["fr"])
     self.assertEqual(course_run.get_languages_display(), "French")
Beispiel #5
0
 def test_models_course_run_get_languages_display_several_languages(self):
     """
     With several languages, it should return a comma separated list of their readable version.
     """
     course_run = CourseRunFactory(languages=["en", "fr"])
     self.assertEqual(course_run.get_languages_display(), "English, French")