def test_purge_page_view_data(self): purge_page_view_data(self.course1.pk) # Expected counts of course 1 self.assertEqual( models.FlowPageVisit.objects.filter( flow_session__course=self.course1).count(), self.course1_n_non_null_answer_fpv) self.assertEqual( models.FlowPageVisit.objects.filter( flow_session__course=self.course1, answer__isnull=True, ).count(), 0) # Counts for course 2 are not affected self.assertEqual( models.FlowPageVisit.objects.filter( flow_session__course=self.course2).count(), self.course2_n_all_fpv) self.assertEqual( models.FlowPageVisit.objects.filter( flow_session__course=self.course2, answer__isnull=True, ).count(), self.course2_n_null_answer_fpv) self.assertEqual(self.mock_update_state.call_count, 0)
def test_purge_page_view_data(self): purge_page_view_data(self.course1.pk) # Expected counts of course 1 self.assertEqual( models.FlowPageVisit.objects.filter( flow_session__course=self.course1).count(), self.course1_n_non_null_answer_fpv ) self.assertEqual( models.FlowPageVisit.objects.filter( flow_session__course=self.course1, answer__isnull=True, ).count(), 0 ) # Counts for course 2 are not affected self.assertEqual( models.FlowPageVisit.objects.filter( flow_session__course=self.course2).count(), self.course2_n_all_fpv ) self.assertEqual( models.FlowPageVisit.objects.filter( flow_session__course=self.course2, answer__isnull=True, ).count(), self.course2_n_null_answer_fpv ) self.assertEqual(self.mock_update_state.call_count, 0)
def test_purge_page_view_data(self): with mock.patch("course.tasks.Course.objects.get") \ as mock_course_object_get: # This is to avoid errors mock_course_object_get.return_value = self.course purge_page_view_data(self.course.pk) mock_course_object_get.assert_called_once_with(id=self.course.pk)
def test_purge_page_view_data(self): with mock.patch("course.tasks.Course.objects.get") \ as mock_course_object_get: # This is to avoid errors mock_course_object_get.return_value = self.course purge_page_view_data(self.course.pk) mock_course_object_get.assert_called_once_with(id=self.course.pk)