diff --git a/lms/djangoapps/course_api/blocks/tests/test_api.py b/lms/djangoapps/course_api/blocks/tests/test_api.py index f4e3d8688d..97055cf5d7 100644 --- a/lms/djangoapps/course_api/blocks/tests/test_api.py +++ b/lms/djangoapps/course_api/blocks/tests/test_api.py @@ -4,6 +4,7 @@ Tests for Blocks api.py from django.test.client import RequestFactory +from milestones.tests.utils import MilestonesTestCaseMixin from student.tests.factories import UserFactory from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase @@ -12,7 +13,7 @@ from xmodule.modulestore.tests.factories import SampleCourseFactory from ..api import get_blocks -class TestGetBlocks(SharedModuleStoreTestCase): +class TestGetBlocks(SharedModuleStoreTestCase, MilestonesTestCaseMixin): """ Tests for the get_blocks function """ diff --git a/lms/djangoapps/course_api/blocks/tests/test_views.py b/lms/djangoapps/course_api/blocks/tests/test_views.py index f8d2e2bf16..d252ef2fec 100644 --- a/lms/djangoapps/course_api/blocks/tests/test_views.py +++ b/lms/djangoapps/course_api/blocks/tests/test_views.py @@ -8,6 +8,7 @@ from string import join from urllib import urlencode from urlparse import urlunparse +from milestones.tests.utils import MilestonesTestCaseMixin from opaque_keys.edx.locator import CourseLocator from student.models import CourseEnrollment from student.tests.factories import AdminFactory, CourseEnrollmentFactory, UserFactory @@ -17,7 +18,7 @@ from xmodule.modulestore.tests.factories import ToyCourseFactory from .helpers import deserialize_usage_key -class TestBlocksView(SharedModuleStoreTestCase): +class TestBlocksView(SharedModuleStoreTestCase, MilestonesTestCaseMixin): """ Test class for BlocksView """ diff --git a/lms/djangoapps/courseware/tests/test_access.py b/lms/djangoapps/courseware/tests/test_access.py index b55188c6fa..26338cd091 100644 --- a/lms/djangoapps/courseware/tests/test_access.py +++ b/lms/djangoapps/courseware/tests/test_access.py @@ -557,7 +557,7 @@ class AccessTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase, MilestonesTes """ Test course access on mobile for staff and students. """ - descriptor = Mock(user_partitions=[]) + descriptor = Mock(id=self.course.id, user_partitions=[]) descriptor._class_tags = {} descriptor.visible_to_staff_only = False descriptor.mobile_available = mobile_available @@ -697,7 +697,7 @@ class CourseOverviewAccessTestCase(ModuleStoreTestCase): self.user_normal = UserFactory.create() self.user_beta_tester = BetaTesterFactory.create(course_key=self.course_not_started.id) self.user_completed_pre_requisite = UserFactory.create() - fulfill_course_milestone(self.user_completed_pre_requisite, self.course_started.id) + fulfill_course_milestone(self.course_started.id, self.user_completed_pre_requisite) self.user_staff = UserFactory.create(is_staff=True) self.user_anonymous = AnonymousUserFactory.create() diff --git a/lms/djangoapps/courseware/tests/test_discussion_xblock.py b/lms/djangoapps/courseware/tests/test_discussion_xblock.py index 34ca9bd406..d245cdbc31 100644 --- a/lms/djangoapps/courseware/tests/test_discussion_xblock.py +++ b/lms/djangoapps/courseware/tests/test_discussion_xblock.py @@ -15,6 +15,7 @@ import mock from django.core.urlresolvers import reverse from course_api.blocks.tests.helpers import deserialize_usage_key from courseware.module_render import get_module_for_descriptor_internal +from milestones.tests.utils import MilestonesTestCaseMixin from student.tests.factories import UserFactory, CourseEnrollmentFactory from xblock.field_data import DictFieldData from xblock.fragment import Fragment @@ -252,7 +253,7 @@ class TestTemplates(TestDiscussionXBlock): @ddt.ddt -class TestXBlockInCourse(SharedModuleStoreTestCase): +class TestXBlockInCourse(SharedModuleStoreTestCase, MilestonesTestCaseMixin): """ Test the discussion xblock as rendered in the course and course API. """ diff --git a/lms/djangoapps/instructor/tests/test_api.py b/lms/djangoapps/instructor/tests/test_api.py index 481e565db6..22cefc03e2 100644 --- a/lms/djangoapps/instructor/tests/test_api.py +++ b/lms/djangoapps/instructor/tests/test_api.py @@ -40,6 +40,7 @@ from courseware.tests.factories import ( from courseware.tests.helpers import LoginEnrollmentTestCase from django_comment_common.models import FORUM_ROLE_COMMUNITY_TA from django_comment_common.utils import seed_permissions_roles +from milestones.tests.utils import MilestonesTestCaseMixin from shoppingcart.models import ( RegistrationCodeRedemption, Order, CouponRedemption, PaidCourseRegistration, Coupon, Invoice, CourseRegistrationCode, CourseRegistrationCodeInvoiceItem, @@ -3277,7 +3278,11 @@ class TestInstructorAPIRegradeTask(SharedModuleStoreTestCase, LoginEnrollmentTes @attr('shard_1') @patch.dict(settings.FEATURES, {'ENTRANCE_EXAMS': True}) @ddt.ddt -class TestEntranceExamInstructorAPIRegradeTask(SharedModuleStoreTestCase, LoginEnrollmentTestCase): +class TestEntranceExamInstructorAPIRegradeTask( + SharedModuleStoreTestCase, + LoginEnrollmentTestCase, + MilestonesTestCaseMixin +): """ Test endpoints whereby instructors can rescore student grades, reset student attempts and delete state for entrance exam. @@ -3368,7 +3373,7 @@ class TestEntranceExamInstructorAPIRegradeTask(SharedModuleStoreTestCase, LoginE self.assertEqual(grades[0], (50.0, 1)) self.assertEqual(grades[1], (100.0, 1)) - def test_reset_entrance_exam_student_attempts_deletall(self): + def test_reset_entrance_exam_student_attempts_delete_all(self): """ Make sure no one can delete all students state on entrance exam. """ url = reverse('reset_student_attempts_for_entrance_exam', kwargs={'course_id': unicode(self.course.id)}) @@ -3415,7 +3420,7 @@ class TestEntranceExamInstructorAPIRegradeTask(SharedModuleStoreTestCase, LoginE }) self.assertEqual(response.status_code, 400) - def test_entrance_exam_sttudent_delete_state(self): + def test_entrance_exam_student_delete_state(self): """ Test delete single student entrance exam state. """ url = reverse('reset_student_attempts_for_entrance_exam', kwargs={'course_id': unicode(self.course.id)}) diff --git a/lms/djangoapps/mobile_api/users/tests.py b/lms/djangoapps/mobile_api/users/tests.py index 5038867bf0..94654db65f 100644 --- a/lms/djangoapps/mobile_api/users/tests.py +++ b/lms/djangoapps/mobile_api/users/tests.py @@ -430,7 +430,7 @@ class TestCourseStatusPATCH(CourseStatusAPITestCase, MobileAuthUserTestMixin, @attr('shard_2') -class TestCourseEnrollmentSerializer(MobileAPITestCase): +class TestCourseEnrollmentSerializer(MobileAPITestCase, MilestonesTestCaseMixin): """ Test the course enrollment serializer """ diff --git a/lms/djangoapps/mobile_api/video_outlines/tests.py b/lms/djangoapps/mobile_api/video_outlines/tests.py index 92b6c13b2e..d1cf419861 100644 --- a/lms/djangoapps/mobile_api/video_outlines/tests.py +++ b/lms/djangoapps/mobile_api/video_outlines/tests.py @@ -10,6 +10,7 @@ from collections import namedtuple import ddt from nose.plugins.attrib import attr from edxval import api +from milestones.tests.utils import MilestonesTestCaseMixin from xmodule.modulestore.tests.factories import ItemFactory from xmodule.video_module import transcripts_utils from xmodule.modulestore.django import modulestore @@ -199,7 +200,7 @@ class TestVideoAPIMixin(object): @attr('shard_2') -class TestNonStandardCourseStructure(MobileAPITestCase, TestVideoAPIMixin): +class TestNonStandardCourseStructure(MobileAPITestCase, TestVideoAPIMixin, MilestonesTestCaseMixin): """ Tests /api/mobile/v0.5/video_outlines/courses/{course_id} with no course set """ diff --git a/lms/envs/test.py b/lms/envs/test.py index ec1ec1b35c..48c175ac88 100644 --- a/lms/envs/test.py +++ b/lms/envs/test.py @@ -75,6 +75,9 @@ FEATURES['EMBARGO'] = True FEATURES['ENABLE_COMBINED_LOGIN_REGISTRATION'] = True +# Enable the milestones app in tests to be consistent with it being enabled in production +FEATURES['MILESTONES_APP'] = True + # Need wiki for courseware views to work. TODO (vshnayder): shouldn't need it. WIKI_ENABLED = True