コード例 #1
0
ファイル: test_models_course.py プロジェクト: phuoclhb/richie
 def test_models_course_field_duration_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 = CourseFactory(duration=[1, "week"])
     request = RequestFactory().get("/")
     self.assertEqual(course.get_duration_display(request), "1 week")
コード例 #2
0
ファイル: test_models_course.py プロジェクト: phuoclhb/richie
 def test_models_course_field_duration_display_singular(self):
     """Validate that a value of 1 time unit is displayed as expected."""
     course = CourseFactory(duration=[1, "day"])
     self.assertEqual(course.get_duration_display(), "1 day")
コード例 #3
0
ファイル: test_models_course.py プロジェクト: phuoclhb/richie
 def test_models_course_field_duration_display_plural(self):
     """Validate that a plural number of time units is displayed as expected."""
     course = CourseFactory(duration=[2, "day"])
     self.assertEqual(course.get_duration_display(), "2 days")
コード例 #4
0
ファイル: test_models_course.py プロジェクト: phuoclhb/richie
 def test_models_course_field_duration_null(self):
     """The duration field can be null."""
     course = CourseFactory(duration=None)
     self.assertIsNone(course.duration)
     self.assertEqual(course.get_duration_display(), "")