Commit 77a38afa by Chris Dodge

add some draft courseware importing paths in common/* tests

parent 0c1c3f11
...@@ -10,6 +10,7 @@ from xblock.runtime import KeyValueStore, InvalidScopeError ...@@ -10,6 +10,7 @@ from xblock.runtime import KeyValueStore, InvalidScopeError
from xmodule.tests import DATA_DIR from xmodule.tests import DATA_DIR
from xmodule.modulestore import Location from xmodule.modulestore import Location
from xmodule.modulestore.mongo import MongoModuleStore, MongoKeyValueStore from xmodule.modulestore.mongo import MongoModuleStore, MongoKeyValueStore
from xmodule.modulestore.draft import DraftModuleStore
from xmodule.modulestore.xml_importer import import_from_xml from xmodule.modulestore.xml_importer import import_from_xml
from xmodule.contentstore.mongo import MongoContentStore from xmodule.contentstore.mongo import MongoContentStore
...@@ -36,7 +37,7 @@ class TestMongoModuleStore(object): ...@@ -36,7 +37,7 @@ class TestMongoModuleStore(object):
# is ok only as long as none of the tests modify the db. # is ok only as long as none of the tests modify the db.
# If (when!) that changes, need to either reload the db, or load # If (when!) that changes, need to either reload the db, or load
# once and copy over to a tmp db for each test. # once and copy over to a tmp db for each test.
cls.store = cls.initdb() cls.store, cls.content_store, cls.draft_store = cls.initdb()
@classmethod @classmethod
def teardownClass(cls): def teardownClass(cls):
...@@ -50,10 +51,14 @@ class TestMongoModuleStore(object): ...@@ -50,10 +51,14 @@ class TestMongoModuleStore(object):
# since MongoModuleStore and MongoContentStore are basically assumed to be together, create this class # since MongoModuleStore and MongoContentStore are basically assumed to be together, create this class
# as well # as well
content_store = MongoContentStore(HOST, DB) content_store = MongoContentStore(HOST, DB)
#
# Also test draft store imports
#
draft_store = DraftModuleStore(HOST, DB, COLLECTION, FS_ROOT, RENDER_TEMPLATE, default_class=DEFAULT_CLASS)
# Explicitly list the courses to load (don't want the big one) # Explicitly list the courses to load (don't want the big one)
courses = ['toy', 'simple'] courses = ['toy', 'simple', 'simple_with_draft']
import_from_xml(store, DATA_DIR, courses, static_content_store=content_store) import_from_xml(store, DATA_DIR, courses, draft_store=draft_store, static_content_store=content_store)
return store return store, content_store, draft_store
@staticmethod @staticmethod
def destroy_db(connection): def destroy_db(connection):
...@@ -81,10 +86,11 @@ class TestMongoModuleStore(object): ...@@ -81,10 +86,11 @@ class TestMongoModuleStore(object):
def test_get_courses(self): def test_get_courses(self):
'''Make sure the course objects loaded properly''' '''Make sure the course objects loaded properly'''
courses = self.store.get_courses() courses = self.store.get_courses()
assert_equals(len(courses), 2) assert_equals(len(courses), 3)
courses.sort(key=lambda c: c.id) courses.sort(key=lambda c: c.id)
assert_equals(courses[0].id, 'edX/simple/2012_Fall') assert_equals(courses[0].id, 'edX/simple/2012_Fall')
assert_equals(courses[1].id, 'edX/toy/2012_Fall') assert_equals(courses[1].id, 'edX/simple_with_draft/2012_Fall')
assert_equals(courses[2].id, 'edX/toy/2012_Fall')
def test_loads(self): def test_loads(self):
assert_not_equals( assert_not_equals(
...@@ -133,7 +139,7 @@ class TestMongoModuleStore(object): ...@@ -133,7 +139,7 @@ class TestMongoModuleStore(object):
Assumes the information is desired for courses[1] ('toy' course). Assumes the information is desired for courses[1] ('toy' course).
""" """
return courses[1].tabs[index]['name'] return courses[2].tabs[index]['name']
# There was a bug where model.save was not getting called after the static tab name # There was a bug where model.save was not getting called after the static tab name
# was set set for tabs that have a URL slug. 'Syllabus' and 'Resources' fall into that # was set set for tabs that have a URL slug. 'Syllabus' and 'Resources' fall into that
......
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