def test_new_downloads_disabled_course_teacher_owner(self): tracker_count_start = Tracker.objects.all().count() update_course_status(1, CourseStatus.NEW_DOWNLOADS_DISABLED) update_course_owner(1, self.teacher.id) response = self.perform_request(1, self.teacher_auth, self.STR_DOWNLOAD) self.assertHttpOK(response) self.assertEqual(response['content-type'], self.STR_ZIP_EXPECTED_CONTENT_TYPE) tracker_count_end = Tracker.objects.all().count() self.assertEqual(tracker_count_start, tracker_count_end)
def test_read_only_course_teacher_owner(self): tracker_count_start = Tracker.objects.all().count() update_course_status(1, CourseStatus.READ_ONLY) update_course_owner(1, self.teacher.id) response = self.perform_request(1, self.teacher_auth, self.STR_DOWNLOAD) self.assertHttpOK(response) self.assertEqual(response['content-type'], self.STR_ZIP_EXPECTED_CONTENT_TYPE) tracker_count_end = Tracker.objects.all().count() self.assertEqual(tracker_count_start, tracker_count_end)
def test_draft_course_teacher_owner(self): tracker_count_start = Tracker.objects.all().count() update_course_visibility(1, True, False) update_course_owner(1, self.teacher.id) resource_url = get_api_url('v2', 'course', 1) + self.STR_DOWNLOAD response = self.api_client.get( resource_url, format='json', data=self.teacher_auth) self.assertHttpOK(response) self.assertEqual(response['content-type'], self.STR_ZIP_EXPECTED_CONTENT_TYPE) update_course_visibility(1, False, False) update_course_owner(1, self.admin.id) tracker_count_end = Tracker.objects.all().count() self.assertEqual(tracker_count_start+1, tracker_count_end)