def test_get_summary_and_trend_data_small(self, mock_enrollment): api_trend = [get_mock_api_enrollment_data(self.course_id)[-1]] mock_enrollment.return_value = api_trend actual_summary, actual_trend = self.presenter.get_summary_and_trend_data() self.assertDictEqual(actual_summary, get_mock_presenter_enrollment_summary_small()) self.assertListEqual(actual_trend, get_mock_presenter_enrollment_data_small(self.course_id))
def test_get_summary_and_trend_data(self, mock_enrollment): expected_trend = get_mock_api_enrollment_data(self.course_id) mock_enrollment.return_value = expected_trend actual_summary, actual_trend = self.presenter.get_summary_and_trend_data() self.assertDictEqual(actual_summary, get_mock_enrollment_summary()) self.assertListEqual(actual_trend, expected_trend)
def test_get_summary_and_trend_data(self, mock_enrollment): mock_enrollment.return_value = utils.get_mock_api_enrollment_data(self.course_id) actual_summary, actual_trend = self.presenter.get_summary_and_trend_data() self.assertDictEqual(actual_summary, utils.get_mock_enrollment_summary()) expected_trend = utils.get_mock_presenter_enrollment_trend(self.course_id) self.assertListEqual(actual_trend, expected_trend)
def test_hide_empty_enrollment_modes(self, mock_enrollment): """ Enrollment modes with no enrolled students should not be returned. """ mock_enrollment.return_value = utils.get_mock_api_enrollment_data(self.course_id, include_verified=False) actual_summary, actual_trend = self.presenter.get_summary_and_trend_data() self.assertDictEqual(actual_summary, utils.get_mock_enrollment_summary(include_verified=False)) expected_trend = utils.get_mock_presenter_enrollment_trend(self.course_id, include_verified=False) self.assertListEqual(actual_trend, expected_trend)
def test_get_summary_and_trend_data_small(self, mock_enrollment): """ Verify the presenter responds appropriately when the course has a limited amount of data (e.g. one data point). """ mock_enrollment.return_value = utils.get_mock_api_enrollment_data(self.course_id)[-1:] actual_summary, actual_trend = self.presenter.get_summary_and_trend_data() self.assertDictEqual(actual_summary, utils.get_mock_presenter_enrollment_summary_small()) self.assertListEqual(actual_trend, utils.get_mock_presenter_enrollment_data_small(self.course_id))
def get_mock_data(self, course_id): return get_mock_api_enrollment_data(course_id)