Commit 0e697f97 by Alexander Kryklia

acceptance tests updated

parent 02de4609
......@@ -8,3 +8,7 @@ Feature: LTI component
Scenario: LTI component in LMS is rendered
Given the course has a LTI component filled with correct data
Then I view the LTI and it is rendered
Scenario: LTI component in LMS is rendered incorreclty
Given the course has a LTI component filled with correct url and client_key, but incorrect client_secret
Then I view the LTI but incorrect_signature warning is rendered
\ No newline at end of file
......@@ -37,6 +37,31 @@ def lti_is_rendered(_step):
with world.browser.get_iframe('ltiLaunchFrame') as iframe:
# iframe does not contain functions from terrain/ui_helpers.py
assert iframe.is_element_present_by_css('.result', wait_time=5)
assert ("This is LTI tool. Success." == world.retry_on_exception(
lambda: iframe.find_by_css('.result')[0].text,
max_attempts=5
))
@step('I view the LTI but incorrect_signature warning is rendered')
def incorrect_lti_is_rendered(_step):
# lti div has class rendered
assert world.is_css_present('div.lti.rendered')
# error is hidden
assert (not world.css_visible('.error_message'))
# iframe is visible
assert world.css_visible('iframe')
#inside iframe test content is presented
with world.browser.get_iframe('ltiLaunchFrame') as iframe:
# iframe does not contain functions from terrain/ui_helpers.py
assert iframe.is_element_present_by_css('.result', wait_time=5)
assert ("Wrong LTI signature" == world.retry_on_exception(
lambda: iframe.find_by_css('.result')[0].text,
max_attempts=5
))
@step('the course has a LTI component filled with correct data')
......@@ -75,6 +100,25 @@ def view_default_lti(_step):
world.browser.visit(url)
@step('the course has a LTI component filled with correct url \
and client_key, but incorrect client_secret')
def view_wrong_data_lti(_step):
coursenum = 'test_course'
i_am_registered_for_the_course(_step, coursenum)
wrong_data_lti_to_course(coursenum)
chapter_name = world.scenario_dict['SECTION'].display_name.replace(
" ", "_")
section_name = chapter_name
url = django_url('/courses/%s/%s/%s/courseware/%s/%s' % (
world.scenario_dict['COURSE'].org,
world.scenario_dict['COURSE'].number,
world.scenario_dict['COURSE'].display_name.replace(' ', '_'),
chapter_name, section_name,)
)
world.browser.visit(url)
def add_correct_lti_to_course(course):
category = 'lti'
world.ItemFactory.create(
......@@ -82,9 +126,9 @@ def add_correct_lti_to_course(course):
category=category,
display_name='LTI',
metadata={
'client_key': 'client_key',
'clent_secret': 'client_secret',
'lti_url': 'http://127.0.0.1:{}/correct_lti_endpoint'.format(world.lti_server_port)
'client_key': world.lti_server.oauth_settings['client_key'],
'client_secret': world.lti_server.oauth_settings['client_secret'],
'lti_url': world.lti_server.oauth_settings['lti_base'] + world.lti_server.oauth_settings['lti_endpoint']
}
)
......@@ -96,3 +140,17 @@ def add_default_lti_to_course(course):
category=category,
display_name='LTI'
)
def wrong_data_lti_to_course(course):
category = 'lti'
world.ItemFactory.create(
parent_location=section_location(course),
category=category,
display_name='LTI',
metadata={
'client_key': world.lti_server.oauth_settings['client_key'],
'client_secret': "wrong_secret",
'lti_url': world.lti_server.oauth_settings['lti_base'] + world.lti_server.oauth_settings['lti_endpoint']
}
)
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