Skip to content
Snippets Groups Projects
Commit cd82abae authored by Mat Peterson's avatar Mat Peterson Committed by Diana Huang
Browse files

More test fixes

Fix opaque key TODOs left over from split-migrator changes and fixed test_image_import to use the correct course

Reset get_location_from_path to pre deprecated opaque-keys

Fix CMS acceptance test

Fixed usage key reassignment in item.py
parent 98649072
No related merge requests found
......@@ -54,6 +54,10 @@ def i_click_on_error_dialog(step):
course_key = SlashSeparatedCourseKey("MITx", "999", "Robot_Super_Course")
# we don't know the actual ID of the vertical. So just check that we did go to a
# vertical page in the course (there should only be one).
vertical_usage_key = course_key.make_usage_key("vertical", "")
vertical_usage_key = course_key.make_usage_key("vertical", None)
vertical_url = reverse_usage_url('unit_handler', vertical_usage_key)
# Remove the trailing "/None" from the URL - we don't know the course ID, so we just want to
# check that we visited a vertical URL.
if vertical_url.endswith("/None"):
vertical_url = vertical_url[:-5]
assert_equal(1, world.browser.url.count(vertical_url))
......@@ -1479,7 +1479,7 @@ class ContentStoreTest(ContentStoreTestCase):
content_store = contentstore()
# Use conditional_and_poll, as it's got an image already
import_from_xml(
__, courses = import_from_xml(
self.store,
self.user.id,
'common/test/data/',
......@@ -1487,7 +1487,7 @@ class ContentStoreTest(ContentStoreTestCase):
static_content_store=content_store
)
course = self.store.get_courses()[0]
course = courses[0]
# Make sure the course image is set to the right place
self.assertEqual(course.course_image, 'images_course_image.jpg')
......
......@@ -318,11 +318,11 @@ def _save_item(user, usage_key, data=None, children=None, metadata=None, nullout
data = old_content['data'] if 'data' in old_content else None
if children is not None:
children_usage_keys = [
UsageKey.from_string(child)
for child
in children
]
children_usage_keys = []
for child in children:
child_usage_key = UsageKey.from_string(child)
child_usage_key = child_usage_key.replace(course_key=modulestore().fill_in_run(child_usage_key.course_key))
children_usage_keys.append(child_usage_key)
existing_item.children = children_usage_keys
# also commit any metadata which might have been passed along
......
......@@ -111,7 +111,7 @@ class StaticContent(object):
"""
Generate an AssetKey for the given path (old c4x/org/course/asset/name syntax)
"""
# TODO OpaqueKey - change to from_string once opaque keys lands
# TODO OpaqueKeys after opaque keys deprecation is working
# return AssetLocation.from_string(path)
return AssetLocation.from_deprecated_string(path)
......
......@@ -43,11 +43,6 @@ class MongoContentStore(ContentStore):
self.fs_files = _db[bucket + ".files"] # the underlying collection GridFS uses
# TODO OpaqueKey - remove after merge of opaque urls
if not hasattr(AssetLocation, 'deprecated'):
setattr(AssetLocation, 'deprecated', True)
setattr(SlashSeparatedCourseKey, 'deprecated', True)
def drop_database(self):
"""
Only for use by test code. Removes the database!
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment