diff --git a/cms/djangoapps/contentstore/features/course-export.py b/cms/djangoapps/contentstore/features/course-export.py
index 56dc5f66bc..2232f9801e 100644
--- a/cms/djangoapps/contentstore/features/course-export.py
+++ b/cms/djangoapps/contentstore/features/course-export.py
@@ -50,11 +50,17 @@ def get_an_error_dialog(step):
@step('I can click to go to the unit with the error$')
def i_click_on_error_dialog(step):
world.click_link_by_text('Correct failed component')
- assert_true(world.css_html("span.inline-error").startswith("Problem i4x://MITx/999/problem"))
- course_key = SlashSeparatedCourseKey("MITx", "999", "Robot_Super_Course")
+
+ problem_string = unicode(world.scenario_dict['COURSE'].id.make_usage_key("problem", 'ignore'))
+ problem_string = u"Problem {}".format(problem_string[:problem_string.rfind('ignore')])
+ assert_true(
+ world.css_html("span.inline-error").startswith(problem_string),
+ u"{} does not start with {}".format(
+ world.css_html("span.inline-error"), problem_string
+ ))
# 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", None)
+ vertical_usage_key = world.scenario_dict['COURSE'].id.make_usage_key("vertical", None)
vertical_url = reverse_usage_url('container_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.
diff --git a/cms/djangoapps/contentstore/features/html-editor.feature b/cms/djangoapps/contentstore/features/html-editor.feature
index 67e39e1531..28bda54840 100644
--- a/cms/djangoapps/contentstore/features/html-editor.feature
+++ b/cms/djangoapps/contentstore/features/html-editor.feature
@@ -24,14 +24,14 @@ Feature: CMS.HTML Editor
Given I have created a Blank HTML Page
When I edit the page
And I add an image with static link "/static/image.jpg" via the Image Plugin Icon
- Then the src link is rewritten to "c4x/MITx/999/asset/image.jpg"
+ Then the src link is rewritten to the asset link "image.jpg"
And the link is shown as "/static/image.jpg" in the Image Plugin
Scenario: TinyMCE link plugin sets urls correctly
Given I have created a Blank HTML Page
When I edit the page
And I add a link with static link "/static/image.jpg" via the Link Plugin Icon
- Then the href link is rewritten to "c4x/MITx/999/asset/image.jpg"
+ Then the href link is rewritten to the asset link "image.jpg"
And the link is shown as "/static/image.jpg" in the Link Plugin
Scenario: TinyMCE and CodeMirror preserve style tags
@@ -76,7 +76,7 @@ Feature: CMS.HTML Editor
Given I have created a Blank HTML Page
When I edit the page
And type "
" in the code editor and press OK
- Then the src link is rewritten to "c4x/MITx/999/asset/image.jpg"
+ Then the src link is rewritten to the asset link "image.jpg"
And the code editor displays "

"
Scenario: Code format toolbar button wraps text with code tags
diff --git a/cms/djangoapps/contentstore/features/html-editor.py b/cms/djangoapps/contentstore/features/html-editor.py
index 9fdcd0a96b..ffc0e451f3 100644
--- a/cms/djangoapps/contentstore/features/html-editor.py
+++ b/cms/djangoapps/contentstore/features/html-editor.py
@@ -155,20 +155,20 @@ def check_raw_editor_text(step):
assert_equal(step.multiline, get_codemirror_value(0))
-@step('the src link is rewritten to "(.*)"$')
+@step('the src link is rewritten to the asset link "(.*)"$')
def image_static_link_is_rewritten(step, path):
# Find the TinyMCE iframe within the main window
with world.browser.get_iframe('mce_0_ifr') as tinymce:
image = tinymce.find_by_tag('img').first
- assert_in(path, image['src'])
+ assert_in(unicode(world.scenario_dict['COURSE'].id.make_asset_key('asset', path)), image['src'])
-@step('the href link is rewritten to "(.*)"$')
+@step('the href link is rewritten to the asset link "(.*)"$')
def link_static_link_is_rewritten(step, path):
# Find the TinyMCE iframe within the main window
with world.browser.get_iframe('mce_0_ifr') as tinymce:
link = tinymce.find_by_tag('a').first
- assert_in(path, link['href'])
+ assert_in(unicode(world.scenario_dict['COURSE'].id.make_asset_key('asset', path)), link['href'])
@step('the expected toolbar buttons are displayed$')
diff --git a/common/djangoapps/terrain/course_helpers.py b/common/djangoapps/terrain/course_helpers.py
index d610c70bfa..ab3004a810 100644
--- a/common/djangoapps/terrain/course_helpers.py
+++ b/common/djangoapps/terrain/course_helpers.py
@@ -3,7 +3,7 @@
import urllib
from lettuce import world
-from django.contrib.auth.models import User, Group
+from django.contrib.auth.models import User
from student.models import CourseEnrollment
from xmodule.modulestore.django import modulestore, clear_existing_modulestores
from xmodule.contentstore.django import _CONTENTSTORE
@@ -33,7 +33,7 @@ def log_in(username='robot', password='test', email='robot@edx.org', name="Robot
Use the auto_auth feature to programmatically log the user in
"""
url = '/auto_auth'
- params = { 'username': username, 'password': password, 'email': email, 'full_name': name }
+ params = {'username': username, 'password': password, 'email': email, 'full_name': name}
url += "?" + urllib.urlencode(params)
world.visit(url)
diff --git a/lms/djangoapps/courseware/features/common.py b/lms/djangoapps/courseware/features/common.py
index 2596be9c73..130f1e80e2 100644
--- a/lms/djangoapps/courseware/features/common.py
+++ b/lms/djangoapps/courseware/features/common.py
@@ -78,12 +78,14 @@ def create_course(_step, course):
parent_location=world.scenario_dict['COURSE'].location,
category='chapter',
display_name='Test Chapter',
+ publish_item=True, # Not needed for direct-only but I'd rather the test didn't know that
)
world.scenario_dict['SECTION'] = world.ItemFactory.create(
parent_location=world.scenario_dict['CHAPTER'].location,
category='sequential',
display_name='Test Section',
+ publish_item=True,
)
@@ -118,12 +120,10 @@ def go_into_course(step):
step.given('And I click on View Courseware')
+# Do we really use these 3 w/ a different course than is in the scenario_dict? if so, why? If not,
+# then get rid of the override arg
def course_id(course_num):
- return SlashSeparatedCourseKey(
- world.scenario_dict['COURSE'].org,
- course_num,
- world.scenario_dict['COURSE'].url_name
- )
+ return world.scenario_dict['COURSE'].id.replace(course=course_num)
def course_location(course_num):
@@ -143,8 +143,8 @@ def visit_scenario_item(item_key):
url = django_url(reverse(
'jump_to',
kwargs={
- 'course_id': world.scenario_dict['COURSE'].id.to_deprecated_string(),
- 'location': world.scenario_dict[item_key].location.to_deprecated_string(),
+ 'course_id': unicode(world.scenario_dict['COURSE'].id),
+ 'location': unicode(world.scenario_dict[item_key].location),
}
))
@@ -157,8 +157,8 @@ def get_courses():
Courses are sorted by course.number.
'''
courses = [c for c in modulestore().get_courses()
- if isinstance(c, CourseDescriptor)]
- courses = sorted(courses, key=lambda course: course.number)
+ if isinstance(c, CourseDescriptor)] # skip error descriptors
+ courses = sorted(courses, key=lambda course: course.location.course)
return courses
@@ -223,13 +223,16 @@ def get_courseware_with_tabs(course_id):
course = get_course_by_id(course_id)
chapters = [chapter for chapter in course.get_children() if not chapter.hide_from_toc]
- courseware = [{'chapter_name': c.display_name_with_default,
- 'sections': [{'section_name': s.display_name_with_default,
- 'clickable_tab_count': len(s.get_children()) if (type(s) == seq_module.SequenceDescriptor) else 0,
- 'tabs': [{'children_count': len(t.get_children()) if (type(t) == vertical_module.VerticalDescriptor) else 0,
- 'class': t.__class__.__name__}
- for t in s.get_children()]}
- for s in c.get_children() if not s.hide_from_toc]}
- for c in chapters]
+ courseware = [{
+ 'chapter_name': c.display_name_with_default,
+ 'sections': [{
+ 'section_name': s.display_name_with_default,
+ 'clickable_tab_count': len(s.get_children()) if (type(s) == seq_module.SequenceDescriptor) else 0,
+ 'tabs': [{
+ 'children_count': len(t.get_children()) if (type(t) == vertical_module.VerticalDescriptor) else 0,
+ 'class': t.__class__.__name__} for t in s.get_children()
+ ]
+ } for s in c.get_children() if not s.hide_from_toc]
+ } for c in chapters]
return courseware