Commit 5e475c87 by cahrens

Code review feedback.

parent 6dce7f29
......@@ -18,8 +18,6 @@ logger = getLogger(__name__)
from terrain.browser import reset_data
TEST_ROOT = settings.COMMON_TEST_DATA_ROOT
PASSWORD = 'test'
EMAIL_EXTENSION = '@edx.org'
@step('I (?:visit|access|open) the Studio homepage$')
......@@ -315,18 +313,18 @@ def other_user_login(step, name):
def fill_login_form():
login_form = world.browser.find_by_css('form#login_form')
login_form.find_by_name('email').fill(name + EMAIL_EXTENSION)
login_form.find_by_name('password').fill(PASSWORD)
login_form.find_by_name('email').fill(name + '@edx.org')
login_form.find_by_name('password').fill("test")
login_form.find_by_name('submit').click()
world.retry_on_exception(fill_login_form)
assert_true(world.is_css_present('.new-course-button'))
world.scenario_dict['USER'] = get_user_by_email(name + EMAIL_EXTENSION)
world.scenario_dict['USER'] = get_user_by_email(name + '@edx.org')
@step(u'the user "([^"]*)" exists( as a course (admin|staff member|is_staff))?$')
def create_other_user(_step, name, has_extra_perms, role_name):
email = name + EMAIL_EXTENSION
user = create_studio_user(uname=name, password=PASSWORD, email=email)
email = name + '@edx.org'
user = create_studio_user(uname=name, password="test", email=email)
if has_extra_perms:
if role_name == "is_staff":
user.is_staff = True
......
......@@ -2,7 +2,6 @@
#pylint: disable=W0621
from lettuce import world, step
from common import EMAIL_EXTENSION
from auth.authz import get_course_groupname_for_role, get_user_by_email
from nose.tools import assert_true, assert_in # pylint: disable=E0611
......@@ -21,7 +20,7 @@ def add_other_user(_step, name):
world.wait(0.5)
email_css = 'input#user-email-input'
world.css_fill(email_css, name + EMAIL_EXTENSION)
world.css_fill(email_css, name + '@edx.org')
if world.is_firefox():
world.trigger_event(email_css)
confirm_css = 'form.create-user button.action-primary'
......@@ -31,7 +30,7 @@ def add_other_user(_step, name):
@step(u'I delete "([^"]*)" from the course team')
def delete_other_user(_step, name):
to_delete_css = '.user-item .item-actions a.remove-user[data-id="{email}"]'.format(
email="{0}{1}".format(name, EMAIL_EXTENSION))
email="{0}{1}".format(name, '@edx.org'))
world.css_click(to_delete_css)
# confirm prompt
# need to wait for the animation to be done, there isn't a good success condition that won't work both on latest chrome and jenkins
......@@ -52,7 +51,7 @@ def other_delete_self(_step):
@step(u'I make "([^"]*)" a course team admin')
def make_course_team_admin(_step, name):
admin_btn_css = '.user-item[data-email="{email}"] .user-actions .add-admin-role'.format(
email=name+EMAIL_EXTENSION)
email=name+'@edx.org')
world.css_click(admin_btn_css)
......@@ -61,7 +60,7 @@ def remove_course_team_admin(_step, outer_capture, name):
if outer_capture == "myself":
email = world.scenario_dict["USER"].email
else:
email = name + EMAIL_EXTENSION
email = name + '@edx.org'
admin_btn_css = '.user-item[data-email="{email}"] .user-actions .remove-admin-role'.format(
email=email)
world.css_click(admin_btn_css)
......@@ -82,7 +81,7 @@ def see_course(_step, do_not_see, gender='self'):
@step(u'"([^"]*)" should( not)? be marked as an admin')
def marked_as_admin(_step, name, not_marked_admin):
flag_css = '.user-item[data-email="{email}"] .flag-role.flag-role-admin'.format(
email=name+EMAIL_EXTENSION)
email=name+'@edx.org')
if not_marked_admin:
assert world.is_css_not_present(flag_css)
else:
......@@ -120,7 +119,7 @@ def can_make_course_admin(_step, can_not_make_admin, outer_capture, name):
if outer_capture == "myself":
email = world.scenario_dict["USER"].email
else:
email = name + EMAIL_EXTENSION
email = name + '@edx.org'
add_button_css = '.user-item[data-email="{email}"] .add-admin-role'.format(email=email)
if can_not_make_admin:
assert world.is_css_not_present(add_button_css)
......
......@@ -14,7 +14,7 @@ TEST_ROOT = settings.COMMON_TEST_DATA_ROOT
ASSET_NAMES_CSS = 'td.name-col > span.title > a.filename'
@step(u'I go to the files and uploads page')
@step(u'I go to the files and uploads page$')
def go_to_uploads(_step):
menu_css = 'li.nav-course-courseware'
uploads_css = 'li.nav-course-courseware-uploads a'
......@@ -121,7 +121,7 @@ def modify_upload(_step, file_name):
_write_test_file(file_name, new_text)
@step(u'I (lock|unlock) "([^"]*)"')
@step(u'I (lock|unlock) "([^"]*)"$')
def lock_unlock_file(_step, _lock_state, file_name):
index = get_index(file_name)
assert index != -1
......@@ -129,19 +129,19 @@ def lock_unlock_file(_step, _lock_state, file_name):
world.css_click(lock_css, index=index)
@step(u'Then "([^"]*)" is (locked|unlocked)')
@step(u'Then "([^"]*)" is (locked|unlocked)$')
def verify_lock_unlock_file(_step, file_name, lock_state):
index = get_index(file_name)
assert index != -1
lock_css = "a.lock-asset-button"
text = (world.css_find(lock_css)[index]).text
text = world.css_text(lock_css, index=index)
if lock_state == "locked":
assert_equal("Unlock this asset", text)
else:
assert_equal("Lock this asset", text)
@step(u'I have opened a course with a (locked|unlocked) asset "([^"]*)"')
@step(u'I have opened a course with a (locked|unlocked) asset "([^"]*)"$')
def open_course_with_locked(step, lock_state, file_name):
step.given('I have opened a new course in studio')
step.given('I go to the files and uploads page')
......@@ -152,7 +152,7 @@ def open_course_with_locked(step, lock_state, file_name):
step.given('I reload the page')
@step(u'Then the asset "([^"]*)" is (viewable|protected)')
@step(u'Then the asset "([^"]*)" is (viewable|protected)$')
def view_asset(_step, file_name, status):
url = '/c4x/MITx/999/asset/' + file_name
if status == 'viewable':
......@@ -168,7 +168,7 @@ def view_asset(_step, file_name, status):
assert error_thrown
@step(u'Then the asset "([^"]*)" can be clicked from the asset index')
@step(u'Then the asset "([^"]*)" can be clicked from the asset index$')
def click_asset_from_index(step, file_name):
# This is not ideal, but I'm having trouble with the middleware not having
# the same user in the request when I hit the URL directly.
......@@ -188,7 +188,7 @@ def _verify_body_text():
world.wait_for(verify_text)
@step('I see a confirmation that the file was deleted')
@step('I see a confirmation that the file was deleted$')
def i_see_a_delete_confirmation(_step):
alert_css = '#notification-confirmation'
assert world.is_css_present(alert_css)
......
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