Import test course instead of using XML-backed course.
This commit is contained in:
@@ -15,6 +15,8 @@ from opaque_keys.edx.locations import SlashSeparatedCourseKey
|
||||
from course_modes.models import CourseMode
|
||||
from track.tests import EventTrackingTestCase
|
||||
from xmodule.modulestore.tests.django_utils import TEST_DATA_MIXED_CLOSED_MODULESTORE
|
||||
from xmodule.modulestore.tests.utils import TEST_DATA_DIR
|
||||
from xmodule.modulestore.xml_importer import import_course_from_xml
|
||||
|
||||
from student.models import CourseEnrollment
|
||||
from student.tests.factories import AdminFactory, CourseEnrollmentAllowedFactory, UserFactory
|
||||
@@ -201,14 +203,30 @@ class AboutTestCaseXML(LoginEnrollmentTestCase, ModuleStoreTestCase):
|
||||
"""
|
||||
MODULESTORE = TEST_DATA_MIXED_CLOSED_MODULESTORE
|
||||
|
||||
# The following XML test course (which lives at common/test/data/2014)
|
||||
# is closed; we're testing that an about page still appears when
|
||||
# the course is already closed
|
||||
xml_course_id = SlashSeparatedCourseKey('edX', 'detached_pages', '2014')
|
||||
def setUp(self):
|
||||
"""
|
||||
Set up the tests
|
||||
"""
|
||||
super(AboutTestCaseXML, self).setUp()
|
||||
|
||||
# this text appears in that course's about page
|
||||
# common/test/data/2014/about/overview.html
|
||||
xml_data = "about page 463139"
|
||||
# The following test course (which lives at common/test/data/2014)
|
||||
# is closed; we're testing that an about page still appears when
|
||||
# the course is already closed
|
||||
self.xml_course_id = self.store.make_course_key('edX', 'detached_pages', '2014')
|
||||
import_course_from_xml(
|
||||
self.store,
|
||||
'test_user',
|
||||
TEST_DATA_DIR,
|
||||
source_dirs=['2014'],
|
||||
static_content_store=None,
|
||||
target_id=self.xml_course_id,
|
||||
raise_on_failure=True,
|
||||
create_if_not_present=True,
|
||||
)
|
||||
|
||||
# this text appears in that course's about page
|
||||
# common/test/data/2014/about/overview.html
|
||||
self.xml_data = "about page 463139"
|
||||
|
||||
@patch.dict('django.conf.settings.FEATURES', {'DISABLE_START_DATES': False})
|
||||
def test_logged_in_xml(self):
|
||||
|
||||
@@ -17,9 +17,11 @@ from util.date_utils import strftime_localized
|
||||
from xmodule.modulestore.tests.django_utils import (
|
||||
ModuleStoreTestCase,
|
||||
SharedModuleStoreTestCase,
|
||||
TEST_DATA_SPLIT_MODULESTORE
|
||||
TEST_DATA_SPLIT_MODULESTORE,
|
||||
TEST_DATA_MIXED_CLOSED_MODULESTORE
|
||||
)
|
||||
from xmodule.modulestore.tests.django_utils import TEST_DATA_MIXED_CLOSED_MODULESTORE
|
||||
from xmodule.modulestore.tests.utils import TEST_DATA_DIR
|
||||
from xmodule.modulestore.xml_importer import import_course_from_xml
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, check_mongo_calls
|
||||
from student.models import CourseEnrollment
|
||||
from student.tests.factories import AdminFactory
|
||||
@@ -214,14 +216,30 @@ class CourseInfoTestCaseXML(LoginEnrollmentTestCase, ModuleStoreTestCase):
|
||||
"""
|
||||
MODULESTORE = TEST_DATA_MIXED_CLOSED_MODULESTORE
|
||||
|
||||
# The following XML test course (which lives at common/test/data/2014)
|
||||
# is closed; we're testing that a course info page still appears when
|
||||
# the course is already closed
|
||||
xml_course_key = SlashSeparatedCourseKey('edX', 'detached_pages', '2014')
|
||||
def setUp(self):
|
||||
"""
|
||||
Set up the tests
|
||||
"""
|
||||
super(CourseInfoTestCaseXML, self).setUp()
|
||||
|
||||
# this text appears in that course's course info page
|
||||
# common/test/data/2014/info/updates.html
|
||||
xml_data = "course info 463139"
|
||||
# The following test course (which lives at common/test/data/2014)
|
||||
# is closed; we're testing that a course info page still appears when
|
||||
# the course is already closed
|
||||
self.xml_course_key = self.store.make_course_key('edX', 'detached_pages', '2014')
|
||||
import_course_from_xml(
|
||||
self.store,
|
||||
'test_user',
|
||||
TEST_DATA_DIR,
|
||||
source_dirs=['2014'],
|
||||
static_content_store=None,
|
||||
target_id=self.xml_course_key,
|
||||
raise_on_failure=True,
|
||||
create_if_not_present=True,
|
||||
)
|
||||
|
||||
# this text appears in that course's course info page
|
||||
# common/test/data/2014/info/updates.html
|
||||
self.xml_data = "course info 463139"
|
||||
|
||||
@mock.patch.dict('django.conf.settings.FEATURES', {'DISABLE_START_DATES': False})
|
||||
def test_logged_in_xml(self):
|
||||
|
||||
@@ -32,9 +32,12 @@ from student.tests.factories import UserFactory
|
||||
from xmodule.modulestore.django import _get_modulestore_branch_setting, modulestore
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.xml_importer import import_course_from_xml
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.django_utils import TEST_DATA_MIXED_TOY_MODULESTORE
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, check_mongo_calls
|
||||
from xmodule.modulestore.tests.django_utils import (
|
||||
ModuleStoreTestCase, TEST_DATA_MIXED_TOY_MODULESTORE
|
||||
)
|
||||
from xmodule.modulestore.tests.factories import (
|
||||
CourseFactory, ItemFactory, ToyCourseFactory, check_mongo_calls
|
||||
)
|
||||
from xmodule.tests.xml import factories as xml
|
||||
from xmodule.tests.xml import XModuleXmlImportTest
|
||||
|
||||
@@ -308,7 +311,12 @@ class XmlCoursesRenderTest(ModuleStoreTestCase):
|
||||
"""Test methods related to rendering courses content for an XML course."""
|
||||
MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE
|
||||
|
||||
toy_course_key = SlashSeparatedCourseKey('edX', 'toy', '2012_Fall')
|
||||
def setUp(self):
|
||||
"""
|
||||
Make sure that course is reloaded every time--clear out the modulestore.
|
||||
"""
|
||||
super(XmlCoursesRenderTest, self).setUp()
|
||||
self.toy_course_key = ToyCourseFactory.create().id
|
||||
|
||||
def test_get_course_info_section_render(self):
|
||||
course = get_course_by_id(self.toy_course_key)
|
||||
|
||||
@@ -27,10 +27,12 @@ from util.milestones_helpers import (
|
||||
from milestones.tests.utils import MilestonesTestCaseMixin
|
||||
from xmodule import tabs as xmodule_tabs
|
||||
from xmodule.modulestore.tests.django_utils import (
|
||||
TEST_DATA_MIXED_TOY_MODULESTORE, TEST_DATA_MIXED_CLOSED_MODULESTORE,
|
||||
SharedModuleStoreTestCase)
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
ModuleStoreTestCase,
|
||||
SharedModuleStoreTestCase
|
||||
)
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
from xmodule.modulestore.tests.utils import TEST_DATA_DIR
|
||||
from xmodule.modulestore.xml_importer import import_course_from_xml
|
||||
|
||||
|
||||
class TabTestCase(SharedModuleStoreTestCase):
|
||||
@@ -289,15 +291,31 @@ class StaticTabDateTestCaseXML(LoginEnrollmentTestCase, ModuleStoreTestCase):
|
||||
|
||||
MODULESTORE = TEST_DATA_MIXED_CLOSED_MODULESTORE
|
||||
|
||||
# The following XML test course (which lives at common/test/data/2014)
|
||||
# is closed; we're testing that tabs still appear when
|
||||
# the course is already closed
|
||||
xml_course_key = SlashSeparatedCourseKey('edX', 'detached_pages', '2014')
|
||||
def setUp(self):
|
||||
"""
|
||||
Set up the tests
|
||||
"""
|
||||
super(StaticTabDateTestCaseXML, self).setUp()
|
||||
|
||||
# this text appears in the test course's tab
|
||||
# common/test/data/2014/tabs/8e4cce2b4aaf4ba28b1220804619e41f.html
|
||||
xml_data = "static 463139"
|
||||
xml_url = "8e4cce2b4aaf4ba28b1220804619e41f"
|
||||
# The following XML test course (which lives at common/test/data/2014)
|
||||
# is closed; we're testing that tabs still appear when
|
||||
# the course is already closed
|
||||
self.xml_course_key = self.store.make_course_key('edX', 'detached_pages', '2014')
|
||||
import_course_from_xml(
|
||||
self.store,
|
||||
'test_user',
|
||||
TEST_DATA_DIR,
|
||||
source_dirs=['2014'],
|
||||
static_content_store=None,
|
||||
target_id=self.xml_course_key,
|
||||
raise_on_failure=True,
|
||||
create_if_not_present=True,
|
||||
)
|
||||
|
||||
# this text appears in the test course's tab
|
||||
# common/test/data/2014/tabs/8e4cce2b4aaf4ba28b1220804619e41f.html
|
||||
self.xml_data = "static 463139"
|
||||
self.xml_url = "8e4cce2b4aaf4ba28b1220804619e41f"
|
||||
|
||||
@patch.dict('django.conf.settings.FEATURES', {'DISABLE_START_DATES': False})
|
||||
def test_logged_in_xml(self):
|
||||
|
||||
Reference in New Issue
Block a user