Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
dd159bce
Commit
dd159bce
authored
Dec 22, 2015
by
John Eskew
Committed by
Clinton Blackburn
May 02, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Import test course instead of using XML-backed course.
parent
775723b9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
93 additions
and
31 deletions
+93
-31
lms/djangoapps/courseware/tests/test_about.py
+25
-7
lms/djangoapps/courseware/tests/test_course_info.py
+27
-9
lms/djangoapps/courseware/tests/test_courses.py
+12
-4
lms/djangoapps/courseware/tests/test_tabs.py
+29
-11
No files found.
lms/djangoapps/courseware/tests/test_about.py
View file @
dd159bce
...
...
@@ -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
()
# 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
xml_data
=
"about page 463139"
# 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
):
...
...
lms/djangoapps/courseware/tests/test_course_info.py
View file @
dd159bce
...
...
@@ -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
()
# 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
xml_data
=
"course info 463139"
# 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
):
...
...
lms/djangoapps/courseware/tests/test_courses.py
View file @
dd159bce
...
...
@@ -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
)
...
...
lms/djangoapps/courseware/tests/test_tabs.py
View file @
dd159bce
...
...
@@ -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
()
# 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
xml_data
=
"static 463139"
xml_url
=
"8e4cce2b4aaf4ba28b1220804619e41f"
# 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
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment