Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
462a42e9
Commit
462a42e9
authored
Sep 05, 2013
by
Alexander Kryklia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update acceptance test
parent
3531f2cb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
13 deletions
+71
-13
common/lib/xmodule/xmodule/modulestore/tests/factories.py
+1
-1
lms/djangoapps/courseware/features/lti.py
+70
-12
No files found.
common/lib/xmodule/xmodule/modulestore/tests/factories.py
View file @
462a42e9
...
...
@@ -27,7 +27,7 @@ class XModuleCourseFactory(Factory):
store
=
editable_modulestore
(
'direct'
)
# Write the data to the mongo datastore
new_course
=
store
.
create_xmodule
(
location
)
new_course
=
store
.
create_xmodule
(
location
,
metadata
=
kwargs
.
get
(
'metadata'
,
None
)
)
# This metadata code was copied from cms/djangoapps/contentstore/views.py
if
display_name
is
not
None
:
...
...
lms/djangoapps/courseware/features/lti.py
View file @
462a42e9
#pylint: disable=C0111
from
django.contrib.auth.models
import
User
from
lettuce
import
world
,
step
from
lettuce.django
import
django_url
from
common
import
i_am_registered_for_the_course
,
section_location
from
common
import
section_location
,
course_id
from
django.contrib.auth.models
import
User
from
student.models
import
CourseEnrollment
from
xmodule.modulestore
import
Location
from
xmodule.modulestore.django
import
modulestore
from
xmodule.course_module
import
CourseDescriptor
from
courseware.courses
import
get_course_by_id
from
xmodule
import
seq_module
,
vertical_module
@step
(
'I view the LTI and it is not rendered'
)
def
lti_is_not_rendered
(
_step
):
...
...
@@ -67,8 +75,13 @@ def incorrect_lti_is_rendered(_step):
@step
(
'the course has a LTI component filled with correct data'
)
def
view_lti_with_data
(
_step
):
coursenum
=
'test_course'
i_am_registered_for_the_course
(
_step
,
coursenum
)
metadata
=
{
'LTIs'
:
[
"test_lti_id:{}:{}"
.
format
(
world
.
lti_server
.
oauth_settings
[
'client_key'
],
world
.
lti_server
.
oauth_settings
[
'client_secret'
]
)]
}
i_am_registered_for_the_course
(
_step
,
coursenum
,
metadata
)
add_correct_lti_to_course
(
coursenum
)
chapter_name
=
world
.
scenario_dict
[
'SECTION'
]
.
display_name
.
replace
(
" "
,
"_"
)
...
...
@@ -85,8 +98,8 @@ def view_lti_with_data(_step):
@step
(
'the course has a LTI component with empty fields'
)
def
view_default_lti
(
_step
):
coursenum
=
'test_course'
i_am_registered_for_the_course
(
_step
,
coursenum
)
metadata
=
{}
i_am_registered_for_the_course
(
_step
,
coursenum
,
{})
add_default_lti_to_course
(
coursenum
)
chapter_name
=
world
.
scenario_dict
[
'SECTION'
]
.
display_name
.
replace
(
" "
,
"_"
)
...
...
@@ -104,8 +117,13 @@ def view_default_lti(_step):
and client_key, but incorrect client_secret'
)
def
view_wrong_data_lti
(
_step
):
coursenum
=
'test_course'
i_am_registered_for_the_course
(
_step
,
coursenum
)
metadata
=
{
'LTIs'
:
[
"test_lti_id:{}:{}"
.
format
(
world
.
lti_server
.
oauth_settings
[
'client_key'
],
world
.
lti_server
.
oauth_settings
[
'client_secret'
]
)]
}
i_am_registered_for_the_course
(
_step
,
coursenum
,
metadata
)
wrong_data_lti_to_course
(
coursenum
)
chapter_name
=
world
.
scenario_dict
[
'SECTION'
]
.
display_name
.
replace
(
" "
,
"_"
)
...
...
@@ -126,9 +144,8 @@ def add_correct_lti_to_course(course):
category
=
category
,
display_name
=
'LTI'
,
metadata
=
{
'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'
]
'lti_id'
:
'test_lti_id'
,
'launch_url'
:
world
.
lti_server
.
oauth_settings
[
'lti_base'
]
+
world
.
lti_server
.
oauth_settings
[
'lti_endpoint'
]
}
)
...
...
@@ -149,8 +166,49 @@ def wrong_data_lti_to_course(course):
category
=
category
,
display_name
=
'LTI'
,
metadata
=
{
'client_key'
:
world
.
lti_server
.
oauth_settings
[
'client_key'
],
'client_secret'
:
"wrong_secret"
,
'lti_id'
:
'test_lti_id'
,
'lti_url'
:
world
.
lti_server
.
oauth_settings
[
'lti_base'
]
+
world
.
lti_server
.
oauth_settings
[
'lti_endpoint'
]
}
)
@step
(
u'The course "([^"]*)" exists$'
)
def
create_course
(
_step
,
course
,
metadata
):
# First clear the modulestore so we don't try to recreate
# the same course twice
# This also ensures that the necessary templates are loaded
world
.
clear_courses
()
# Create the course
# We always use the same org and display name,
# but vary the course identifier (e.g. 600x or 191x)
world
.
scenario_dict
[
'COURSE'
]
=
world
.
CourseFactory
.
create
(
org
=
'edx'
,
number
=
course
,
display_name
=
'Test Course'
,
metadata
=
metadata
)
# Add a section to the course to contain problems
world
.
scenario_dict
[
'SECTION'
]
=
world
.
ItemFactory
.
create
(
parent_location
=
world
.
scenario_dict
[
'COURSE'
]
.
location
,
display_name
=
'Test Section'
)
world
.
ItemFactory
.
create
(
parent_location
=
world
.
scenario_dict
[
'SECTION'
]
.
location
,
category
=
'sequential'
,
display_name
=
'Test Section'
)
@step
(
u'I am registered for the course "([^"]*)"$'
)
def
i_am_registered_for_the_course
(
step
,
course
,
metadata
):
# Create the course
create_course
(
step
,
course
,
metadata
)
# Create the user
world
.
create_user
(
'robot'
,
'test'
)
u
=
User
.
objects
.
get
(
username
=
'robot'
)
# If the user is not already enrolled, enroll the user.
# TODO: change to factory
CourseEnrollment
.
enroll
(
u
,
course_id
(
course
))
world
.
log_in
(
username
=
'robot'
,
password
=
'test'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment