diff --git a/cms/djangoapps/contentstore/features/course-export.py b/cms/djangoapps/contentstore/features/course-export.py index 2232f9801e..9ae6eead3e 100644 --- a/cms/djangoapps/contentstore/features/course-export.py +++ b/cms/djangoapps/contentstore/features/course-export.py @@ -60,10 +60,10 @@ def i_click_on_error_dialog(step): )) # 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 = world.scenario_dict['COURSE'].id.make_usage_key("vertical", None) + vertical_usage_key = world.scenario_dict['COURSE'].id.make_usage_key("vertical", "test") 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. - if vertical_url.endswith("/None"): + if vertical_url.endswith("/test") or vertical_url.endswith("@test"): vertical_url = vertical_url[:-5] assert_equal(1, world.browser.url.count(vertical_url)) diff --git a/cms/djangoapps/contentstore/features/course-updates.feature b/cms/djangoapps/contentstore/features/course-updates.feature index 152da9c349..e15376ca29 100644 --- a/cms/djangoapps/contentstore/features/course-updates.feature +++ b/cms/djangoapps/contentstore/features/course-updates.feature @@ -60,22 +60,22 @@ Feature: CMS.Course updates And I go to the course updates page When I add a new update with the text "" # Can only do partial text matches because of the quotes with in quotes (and regexp step matching). - Then I should see the update "/c4x/MITx/999/asset/my_img.jpg" + Then I should see the asset update to "my_img.jpg" And I change the update from "/static/my_img.jpg" to "" - Then I should see the update "/c4x/MITx/999/asset/modified.jpg" + Then I should see the asset update to "modified.jpg" And when I reload the page - Then I should see the update "/c4x/MITx/999/asset/modified.jpg" + Then I should see the asset update to "modified.jpg" Scenario: Static links are rewritten when previewing handouts Given I have opened a new course in Studio And I go to the course updates page When I modify the handout to "
" # Can only do partial text matches because of the quotes with in quotes (and regexp step matching). - Then I see the handout "/c4x/MITx/999/asset/my_img.jpg" + Then I see the handout image link "my_img.jpg" And I change the handout from "/static/my_img.jpg" to "" - Then I see the handout "/c4x/MITx/999/asset/modified.jpg" + Then I see the handout image link "modified.jpg" And when I reload the page - Then I see the handout "/c4x/MITx/999/asset/modified.jpg" + Then I see the handout image link "modified.jpg" Scenario: Users cannot save handouts with bad html until edit or update it properly Given I have opened a new course in Studio diff --git a/cms/djangoapps/contentstore/features/course-updates.py b/cms/djangoapps/contentstore/features/course-updates.py index 69670013cb..217874f911 100644 --- a/cms/djangoapps/contentstore/features/course-updates.py +++ b/cms/djangoapps/contentstore/features/course-updates.py @@ -4,6 +4,7 @@ from lettuce import world, step from selenium.webdriver.common.keys import Keys from common import type_in_codemirror, get_codemirror_value +from opaque_keys.edx.locations import CourseLocator from nose.tools import assert_in # pylint: disable=E0611 @@ -29,6 +30,14 @@ def check_update(_step, text): assert_in(text, update_html) +@step(u'I should see the asset update to "([^"]*)"$') +def check_asset_update(_step, asset_file): + update_css = 'div.update-contents' + update_html = world.css_find(update_css).html + asset_key = world.scenario_dict['COURSE'].id.make_asset_key(asset_type='asset', path=asset_file) + assert_in(unicode(asset_key), update_html) + + @step(u'I should not see the update "([^"]*)"$') def check_no_update(_step, text): update_css = 'div.update-contents' @@ -90,6 +99,14 @@ def check_handout(_step, handout): assert_in(handout, world.css_html(handout_css)) +@step(u'I see the handout image link "([^"]*)"$') +def check_handout_image_link(_step, image_file): + handout_css = 'div.handouts-content' + handout_html = world.css_html(handout_css) + asset_key = world.scenario_dict['COURSE'].id.make_asset_key(asset_type='asset', path=image_file) + assert_in(unicode(asset_key), handout_html) + + @step(u'I see the handout error text') def check_handout_error(_step): handout_error_css = 'div#handout_error' diff --git a/cms/djangoapps/contentstore/features/upload.py b/cms/djangoapps/contentstore/features/upload.py index b905c935b5..e99296da49 100644 --- a/cms/djangoapps/contentstore/features/upload.py +++ b/cms/djangoapps/contentstore/features/upload.py @@ -185,7 +185,13 @@ def open_course_with_locked(step, lock_state): @step(u'Then the asset is (viewable|protected)$') def view_asset(_step, status): - url = django_url('/c4x/MITx/999/asset/asset.html') + asset_loc = world.scenario_dict['COURSE'].id.make_asset_key(asset_type='asset', path='asset.html') + svr_loc = django_url() + asset_url = unicode(asset_loc) + divider = '/' + if asset_url[0] == '/': + divider = '' + url = '{}{}{}'.format(svr_loc, divider, asset_url) if status == 'viewable': expected_text = 'test file' else: