Commit 7fc02076 by sanfordstudent Committed by GitHub

Merge pull request #13083 from edx/tnl/enable_milestones

Enable Milestones in LMS Tests
parents e861b609 a1a5a0fc
......@@ -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
"""
......
......@@ -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
"""
......
......@@ -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()
......
......@@ -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.
"""
......
......@@ -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)})
......
......@@ -430,7 +430,7 @@ class TestCourseStatusPATCH(CourseStatusAPITestCase, MobileAuthUserTestMixin,
@attr('shard_2')
class TestCourseEnrollmentSerializer(MobileAPITestCase):
class TestCourseEnrollmentSerializer(MobileAPITestCase, MilestonesTestCaseMixin):
"""
Test the course enrollment serializer
"""
......
......@@ -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
"""
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment