Fix hardcoded course urls
This commit is contained in:
@@ -61,20 +61,14 @@ def change_assignment_name(step, old_name, new_name):
|
||||
index = get_type_index(old_name)
|
||||
f = world.css_find(name_id)[index]
|
||||
assert_not_equal(index, -1)
|
||||
for count in range(len(old_name)):
|
||||
for __ in xrange(len(old_name)):
|
||||
f._element.send_keys(Keys.END, Keys.BACK_SPACE)
|
||||
f._element.send_keys(new_name)
|
||||
|
||||
|
||||
@step(u'I go back to the main course page')
|
||||
def main_course_page(step):
|
||||
course_name = world.scenario_dict['COURSE'].display_name.replace(' ', '_')
|
||||
course_key = SlashSeparatedCourseKey(
|
||||
world.scenario_dict['COURSE'].org,
|
||||
world.scenario_dict['COURSE'].number,
|
||||
course_name
|
||||
)
|
||||
main_page_link = reverse_course_url('course_handler', course_key)
|
||||
main_page_link = reverse_course_url('course_handler', world.scenario_dict['COURSE'].id)
|
||||
|
||||
world.visit(main_page_link)
|
||||
assert_in('Course Outline', world.css_text('h1.page-header'))
|
||||
|
||||
@@ -81,6 +81,8 @@ def click_the_link_with_the_text_group1(step, linktext):
|
||||
|
||||
@step('I should see that the path is "([^"]*)"$')
|
||||
def i_should_see_that_the_path_is(step, path):
|
||||
if 'COURSE' in world.scenario_dict:
|
||||
path = path.format(world.scenario_dict['COURSE'].id)
|
||||
assert world.url_equals(path), (
|
||||
"path should be {!r} but is {!r}".format(path, world.browser.url)
|
||||
)
|
||||
@@ -185,6 +187,8 @@ def dialogs_are_closed(step):
|
||||
|
||||
@step(u'visit the url "([^"]*)"')
|
||||
def visit_url(step, url):
|
||||
if 'COURSE' in world.scenario_dict:
|
||||
url = url.format(world.scenario_dict['COURSE'].id)
|
||||
world.browser.visit(lettuce.django.django_url(url))
|
||||
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@ Feature: LMS.Events
|
||||
Scenario Outline: An event is emitted for each request
|
||||
Given: I am registered for the course "6.002x"
|
||||
And I visit the url "<url>"
|
||||
Then a "<url>" server event is emitted
|
||||
Then a course url "<url>" event is emitted
|
||||
|
||||
Examples:
|
||||
| url |
|
||||
| /dashboard |
|
||||
| /courses/edx/6.002x/Test_Course/info |
|
||||
| /courses/edx/6.002x/Test_Course/courseware |
|
||||
| url |
|
||||
| /dashboard |
|
||||
| /courses/{}/info |
|
||||
| /courses/{}/courseware |
|
||||
|
||||
@@ -36,6 +36,11 @@ def reset_between_outline_scenarios(_scenario, order, outline, reasons_to_fail):
|
||||
world.event_collection.drop()
|
||||
|
||||
|
||||
@step(r'[aA]n? course url "(.*)" event is emitted$')
|
||||
def course_url_event_is_emitted(_step, url_regex):
|
||||
event_type = url_regex.format(world.scenario_dict['COURSE'].id)
|
||||
n_events_are_emitted(_step, 1, event_type, "server")
|
||||
|
||||
@step(r'([aA]n?|\d+) "(.*)" (server|browser) events? is emitted$')
|
||||
def n_events_are_emitted(_step, count, event_type, event_source):
|
||||
|
||||
|
||||
@@ -34,8 +34,8 @@ Feature: LMS.Login in as a registered user
|
||||
And The course "6.002x" exists
|
||||
And I am registered for the course "6.002x"
|
||||
And I am not logged in
|
||||
And I visit the url "/courses/edx/6.002x/Test_Course/courseware"
|
||||
And I should see that the path is "/accounts/login?next=/courses/edx/6.002x/Test_Course/courseware"
|
||||
And I visit the url "/courses/{}/courseware"
|
||||
And I should see that the path is "/accounts/login?next=/courses/{}/courseware"
|
||||
When I submit my credentials on the login form
|
||||
And I wait for "2" seconds
|
||||
Then the page title should contain "6.002x Courseware"
|
||||
|
||||
Reference in New Issue
Block a user