Commit 751994b9 by Jay Zoldak

pep8 and pylint fixes

parent 37933cb5
...@@ -223,6 +223,7 @@ def i_enabled_the_advanced_module(step, module): ...@@ -223,6 +223,7 @@ def i_enabled_the_advanced_module(step, module):
type_in_codemirror(0, '["%s"]' % module) type_in_codemirror(0, '["%s"]' % module)
press_the_notification_button(step, 'Save') press_the_notification_button(step, 'Save')
@world.absorb @world.absorb
def add_unit(): def add_unit():
world.clear_courses() world.clear_courses()
......
...@@ -50,8 +50,8 @@ def other_delete_self(_step): ...@@ -50,8 +50,8 @@ def other_delete_self(_step):
@step(u'I make "([^"]*)" a course team admin') @step(u'I make "([^"]*)" a course team admin')
def make_course_team_admin(_step, name): def make_course_team_admin(_step, name):
admin_btn_css = '.user-item[data-email="{email}"] .user-actions .add-admin-role'.format( admin_btn_css = '.user-item[data-email="{name}@edx.org"] .user-actions .add-admin-role'.format(
email=name+'@edx.org') name=name)
world.css_click(admin_btn_css) world.css_click(admin_btn_css)
...@@ -80,8 +80,8 @@ def see_course(_step, do_not_see, gender='self'): ...@@ -80,8 +80,8 @@ def see_course(_step, do_not_see, gender='self'):
@step(u'"([^"]*)" should( not)? be marked as an admin') @step(u'"([^"]*)" should( not)? be marked as an admin')
def marked_as_admin(_step, name, not_marked_admin): def marked_as_admin(_step, name, not_marked_admin):
flag_css = '.user-item[data-email="{email}"] .flag-role.flag-role-admin'.format( flag_css = '.user-item[data-email="{name}@edx.org"] .flag-role.flag-role-admin'.format(
email=name+'@edx.org') name=name)
if not_marked_admin: if not_marked_admin:
assert world.is_css_not_present(flag_css) assert world.is_css_not_present(flag_css)
else: else:
......
...@@ -2,6 +2,7 @@ import os ...@@ -2,6 +2,7 @@ import os
from lettuce import world from lettuce import world
from django.conf import settings from django.conf import settings
def import_file(filename): def import_file(filename):
world.browser.execute_script("$('input.file-input').css('display', 'block')") world.browser.execute_script("$('input.file-input').css('display', 'block')")
path = os.path.join(settings.COMMON_TEST_DATA_ROOT, "imports", filename) path = os.path.join(settings.COMMON_TEST_DATA_ROOT, "imports", filename)
......
...@@ -180,7 +180,7 @@ def cannot_edit_fail(_step): ...@@ -180,7 +180,7 @@ def cannot_edit_fail(_step):
def i_change_grace_period(_step, grace_period): def i_change_grace_period(_step, grace_period):
grace_period_css = '#course-grading-graceperiod' grace_period_css = '#course-grading-graceperiod'
ele = world.css_find(grace_period_css).first ele = world.css_find(grace_period_css).first
# Sometimes it takes a moment for the JavaScript # Sometimes it takes a moment for the JavaScript
# to populate the field. If we don't wait for # to populate the field. If we don't wait for
# this to happen, then we can end up with # this to happen, then we can end up with
......
...@@ -47,7 +47,7 @@ def name_textbook(_step, name): ...@@ -47,7 +47,7 @@ def name_textbook(_step, name):
@step(u'I name the (first|second|third) chapter "([^"]*)"') @step(u'I name the (first|second|third) chapter "([^"]*)"')
def name_chapter(_step, ordinal, name): def name_chapter(_step, ordinal, name):
index = ["first", "second", "third"].index(ordinal) index = ["first", "second", "third"].index(ordinal)
input_css = ".textbook .chapter{i} input.chapter-name".format(i=index+1) input_css = ".textbook .chapter{i} input.chapter-name".format(i=index + 1)
world.css_fill(input_css, name) world.css_fill(input_css, name)
if world.is_firefox(): if world.is_firefox():
world.trigger_event(input_css) world.trigger_event(input_css)
...@@ -56,7 +56,7 @@ def name_chapter(_step, ordinal, name): ...@@ -56,7 +56,7 @@ def name_chapter(_step, ordinal, name):
@step(u'I type in "([^"]*)" for the (first|second|third) chapter asset') @step(u'I type in "([^"]*)" for the (first|second|third) chapter asset')
def asset_chapter(_step, name, ordinal): def asset_chapter(_step, name, ordinal):
index = ["first", "second", "third"].index(ordinal) index = ["first", "second", "third"].index(ordinal)
input_css = ".textbook .chapter{i} input.chapter-asset-path".format(i=index+1) input_css = ".textbook .chapter{i} input.chapter-asset-path".format(i=index + 1)
world.css_fill(input_css, name) world.css_fill(input_css, name)
if world.is_firefox(): if world.is_firefox():
world.trigger_event(input_css) world.trigger_event(input_css)
...@@ -65,7 +65,7 @@ def asset_chapter(_step, name, ordinal): ...@@ -65,7 +65,7 @@ def asset_chapter(_step, name, ordinal):
@step(u'I click the Upload Asset link for the (first|second|third) chapter') @step(u'I click the Upload Asset link for the (first|second|third) chapter')
def click_upload_asset(_step, ordinal): def click_upload_asset(_step, ordinal):
index = ["first", "second", "third"].index(ordinal) index = ["first", "second", "third"].index(ordinal)
button_css = ".textbook .chapter{i} .action-upload".format(i=index+1) button_css = ".textbook .chapter{i} .action-upload".format(i=index + 1)
world.css_click(button_css) world.css_click(button_css)
......
...@@ -191,7 +191,7 @@ def view_asset(_step, status): ...@@ -191,7 +191,7 @@ def view_asset(_step, status):
# Note that world.visit would trigger a 403 error instead of displaying "Unauthorized" # Note that world.visit would trigger a 403 error instead of displaying "Unauthorized"
# Instead, we can drop back into the selenium driver get command. # Instead, we can drop back into the selenium driver get command.
world.browser.driver.get(url) world.browser.driver.get(url)
assert_equal(world.css_text('body'),expected_text) assert_equal(world.css_text('body'), expected_text)
@step('I see a confirmation that the file was deleted$') @step('I see a confirmation that the file was deleted$')
......
...@@ -22,7 +22,7 @@ logger = getLogger(__name__) ...@@ -22,7 +22,7 @@ logger = getLogger(__name__)
@step(r'I wait (?:for )?"(\d+\.?\d*)" seconds?$') @step(r'I wait (?:for )?"(\d+\.?\d*)" seconds?$')
def wait(step, seconds): def wait_for_seconds(step, seconds):
world.wait(seconds) world.wait(seconds)
...@@ -145,9 +145,9 @@ def should_see_in_the_page(step, doesnt_appear, text): ...@@ -145,9 +145,9 @@ def should_see_in_the_page(step, doesnt_appear, text):
else: else:
multiplier = 1 multiplier = 1
if doesnt_appear: if doesnt_appear:
assert world.browser.is_text_not_present(text, wait_time=5*multiplier) assert world.browser.is_text_not_present(text, wait_time=5 * multiplier)
else: else:
assert world.browser.is_text_present(text, wait_time=5*multiplier) assert world.browser.is_text_present(text, wait_time=5 * multiplier)
@step('I am logged in$') @step('I am logged in$')
......
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