Commit db6fa9a3 by Jay Zoldak

Pep8fix lettuce test code

parent 040f840c
...@@ -146,6 +146,7 @@ def add_section(name='My Section'): ...@@ -146,6 +146,7 @@ def add_section(name='My Section'):
span_css = 'span.section-name-span' span_css = 'span.section-name-span'
assert_true(world.browser.is_element_present_by_css(span_css, 5)) assert_true(world.browser.is_element_present_by_css(span_css, 5))
def add_subsection(name='Subsection One'): def add_subsection(name='Subsection One'):
css = 'a.new-subsection-item' css = 'a.new-subsection-item'
css_click(css) css_click(css)
......
...@@ -8,6 +8,7 @@ from logging import getLogger ...@@ -8,6 +8,7 @@ from logging import getLogger
logger = getLogger(__name__) logger = getLogger(__name__)
## support functions ## support functions
def get_courses(): def get_courses():
''' '''
Returns dict of lists of courses available, keyed by course.org (ie university). Returns dict of lists of courses available, keyed by course.org (ie university).
...@@ -81,8 +82,8 @@ def get_courseware_with_tabs(course_id): ...@@ -81,8 +82,8 @@ def get_courseware_with_tabs(course_id):
course = get_course_by_id(course_id) course = get_course_by_id(course_id)
chapters = [chapter for chapter in course.get_children() if chapter.metadata.get('hide_from_toc', 'false').lower() != 'true'] chapters = [chapter for chapter in course.get_children() if chapter.metadata.get('hide_from_toc', 'false').lower() != 'true']
courseware = [{'chapter_name': c.display_name, courseware = [{'chapter_name': c.display_name,
'sections': [{'section_name': s.display_name, 'sections': [{'section_name': s.display_name,
'clickable_tab_count': len(s.get_children()) if (type(s) == seq_module.SequenceDescriptor) else 0, '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, 'tabs': [{'children_count': len(t.get_children()) if (type(t) == vertical_module.VerticalDescriptor) else 0,
'class': t.__class__.__name__} 'class': t.__class__.__name__}
for t in s.get_children()]} for t in s.get_children()]}
......
...@@ -33,6 +33,7 @@ def click_the_dropdown(step): ...@@ -33,6 +33,7 @@ def click_the_dropdown(step):
e.click() e.click()
#### helper functions #### helper functions
def user_is_an_unactivated_user(uname): def user_is_an_unactivated_user(uname):
u = User.objects.get(username=uname) u = User.objects.get(username=uname)
u.is_active = False u.is_active = False
......
from lettuce import world, step from lettuce import world, step
@step('I register for the course numbered "([^"]*)"$') @step('I register for the course numbered "([^"]*)"$')
def i_register_for_the_course(step, course): def i_register_for_the_course(step, course):
courses_section = world.browser.find_by_css('section.courses') courses_section = world.browser.find_by_css('section.courses')
...@@ -13,11 +14,13 @@ def i_register_for_the_course(step, course): ...@@ -13,11 +14,13 @@ def i_register_for_the_course(step, course):
assert world.browser.is_element_present_by_css('section.container.dashboard') assert world.browser.is_element_present_by_css('section.container.dashboard')
@step(u'I should see the course numbered "([^"]*)" in my dashboard$') @step(u'I should see the course numbered "([^"]*)" in my dashboard$')
def i_should_see_that_course_in_my_dashboard(step, course): def i_should_see_that_course_in_my_dashboard(step, course):
course_link_css = 'section.my-courses a[href*="%s"]' % course course_link_css = 'section.my-courses a[href*="%s"]' % course
assert world.browser.is_element_present_by_css(course_link_css) assert world.browser.is_element_present_by_css(course_link_css)
@step(u'I press the "([^"]*)" button in the Unenroll dialog') @step(u'I press the "([^"]*)" button in the Unenroll dialog')
def i_press_the_button_in_the_unenroll_dialog(step, value): def i_press_the_button_in_the_unenroll_dialog(step, value):
button_css = 'section#unenroll-modal input[value="%s"]' % value button_css = 'section#unenroll-modal input[value="%s"]' % value
......
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