Commit fd6c9bed by John Eskew Committed by Don Mitchell

Fix course export/updates and upload CMS acceptance tests.

parent edffa735
......@@ -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))
......@@ -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 "<img src='/static/my_img.jpg'/>"
# 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 "<img src='/static/modified.jpg'/>"
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 "<ol><img src='/static/my_img.jpg'/></ol>"
# 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 "<img src='/static/modified.jpg'/>"
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
......
......@@ -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'
......
......@@ -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:
......
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