def test_models_course_field_effort_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(effort=[1, "week", "month"]) request = RequestFactory().get("/") self.assertEqual(course.get_effort_display(request), "1 week/month")
def test_models_course_field_effort_display_singular(self): """Validate that a value of 1 time unit is displayed as expected.""" course = CourseFactory(effort=[1, "day", "week"]) self.assertEqual(course.get_effort_display(), "1 day/week")
def test_models_course_field_effort_display_plural(self): """Validate that a plural number of time units is displayed as expected.""" course = CourseFactory(effort=[2, "day", "week"]) self.assertEqual(course.get_effort_display(), "2 days/week")
def test_models_course_field_effort_null(self): """The effort field can be null.""" course = CourseFactory(effort=None) self.assertIsNone(course.effort) self.assertEqual(course.get_effort_display(), "")