Commit 194c5096 by sanfordstudent Committed by GitHub

Merge pull request #13123 from edx/sstudent/milestones-fie

Fixing test failures on master
parents 59ac60f2 03256937
......@@ -5,10 +5,11 @@ from __future__ import absolute_import
import time
from lettuce import world, step
from lettuce import world, step, before
from lettuce.django import django_url
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from milestones.models import MilestoneRelationshipType
from student.models import CourseEnrollment
from xmodule.modulestore.django import modulestore
from xmodule.course_module import CourseDescriptor
......@@ -18,6 +19,12 @@ from logging import getLogger
logger = getLogger(__name__)
@before.each_scenario # pylint: disable=no-member
def setup_milestones_app(scenario): # pylint: disable=unused-argument
MilestoneRelationshipType.objects.get_or_create(name='requires')
MilestoneRelationshipType.objects.get_or_create(name='fulfills')
@step('I (.*) capturing of screenshots before and after each step$')
def configure_screenshots_for_all_steps(_step, action):
"""
......
......@@ -22,6 +22,7 @@ from courseware.masquerade import (
from courseware.tests.factories import StaffFactory
from courseware.tests.helpers import LoginEnrollmentTestCase, get_request_for_user
from courseware.tests.test_submitting_problems import ProblemSubmissionTestMixin
from milestones.tests.utils import MilestonesTestCaseMixin
from student.tests.factories import UserFactory
from xblock.runtime import DictKeyValueStore
from xmodule.modulestore.django import modulestore
......@@ -31,7 +32,7 @@ from xmodule.partitions.partitions import Group, UserPartition
from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
class MasqueradeTestCase(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
class MasqueradeTestCase(SharedModuleStoreTestCase, LoginEnrollmentTestCase, MilestonesTestCaseMixin):
"""
Base class for masquerade tests that sets up a test course and enrolls a user in the course.
"""
......
......@@ -407,7 +407,7 @@ class ModuleRenderTestCase(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
@attr('shard_1')
class TestHandleXBlockCallback(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
class TestHandleXBlockCallback(SharedModuleStoreTestCase, LoginEnrollmentTestCase, MilestonesTestCaseMixin):
"""
Test the handle_xblock_callback function
"""
......
......@@ -11,6 +11,7 @@ from django.test.utils import override_settings
from courseware.tests.helpers import LoginEnrollmentTestCase
from courseware.tests.factories import GlobalStaffFactory
from milestones.tests.utils import MilestonesTestCaseMixin
from student.tests.factories import UserFactory
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
......@@ -18,7 +19,7 @@ from xmodule.modulestore.django import modulestore
@attr('shard_1')
class TestNavigation(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
class TestNavigation(SharedModuleStoreTestCase, LoginEnrollmentTestCase, MilestonesTestCaseMixin):
"""
Check that navigation state is saved properly.
"""
......
......@@ -7,6 +7,7 @@ from nose.plugins.attrib import attr
from courseware.module_render import get_module_for_descriptor
from courseware.model_data import FieldDataCache
from milestones.tests.utils import MilestonesTestCaseMixin
from student.tests.factories import UserFactory, CourseEnrollmentFactory
from xmodule.modulestore.tests.factories import ItemFactory, CourseFactory
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
......@@ -15,7 +16,7 @@ from openedx.core.djangoapps.user_api.tests.factories import UserCourseTagFactor
@attr('shard_1')
class SplitTestBase(SharedModuleStoreTestCase):
class SplitTestBase(SharedModuleStoreTestCase, MilestonesTestCaseMixin):
"""
Sets up a basic course and user for split test testing.
Also provides tests of rendered HTML for two user_tag conditions, 0 and 1.
......
......@@ -191,7 +191,7 @@ class TestJumpTo(ModuleStoreTestCase):
@attr('shard_2')
@ddt.ddt
class ViewsTestCase(ModuleStoreTestCase):
class ViewsTestCase(ModuleStoreTestCase, MilestonesTestCaseMixin):
"""
Tests for views.py methods.
"""
......@@ -939,7 +939,7 @@ class ViewsTestCase(ModuleStoreTestCase):
@attr('shard_1')
# setting TIME_ZONE_DISPLAYED_FOR_DEADLINES explicitly
@override_settings(TIME_ZONE_DISPLAYED_FOR_DEADLINES="UTC")
class BaseDueDateTests(ModuleStoreTestCase):
class BaseDueDateTests(ModuleStoreTestCase, MilestonesTestCaseMixin):
"""
Base class that verifies that due dates are rendered correctly on a page
"""
......@@ -1816,7 +1816,7 @@ class ViewCheckerBlock(XBlock):
@attr('shard_1')
@ddt.ddt
class TestIndexView(ModuleStoreTestCase):
class TestIndexView(ModuleStoreTestCase, MilestonesTestCaseMixin):
"""
Tests of the courseware.views.index view.
"""
......@@ -1888,7 +1888,7 @@ class TestIndexView(ModuleStoreTestCase):
@ddt.ddt
class TestIndewViewWithVerticalPositions(ModuleStoreTestCase):
class TestIndexViewWithVerticalPositions(ModuleStoreTestCase, MilestonesTestCaseMixin):
"""
Test the index view to handle vertical positions. Confirms that first position is loaded
if input position is non-positive or greater than number of positions available.
......@@ -1898,7 +1898,7 @@ class TestIndewViewWithVerticalPositions(ModuleStoreTestCase):
"""
Set up initial test data
"""
super(TestIndewViewWithVerticalPositions, self).setUp()
super(TestIndexViewWithVerticalPositions, self).setUp()
self.user = UserFactory()
......
......@@ -4,10 +4,14 @@ Tests for the DoneXBlock.
This is nice as a simple example of the edX XBlock test framework.
'''
from mock import patch
from openedx.tests.xblock_integration.xblock_testcase import XBlockTestCase
# We set MILESTONES_APP to False to avoid XBlock access issues in this test,
# which is meant to exist independent of our particular LMS instance.
# pylint: disable=abstract-method
@patch.dict('django.conf.settings.FEATURES', {'MILESTONES_APP': False})
class TestDone(XBlockTestCase):
"""
Simple tests for the completion XBlock. We set up a page with two
......
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