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
1f1bba55
Commit
1f1bba55
authored
Jun 27, 2013
by
JonahStanley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Scenario Dictionary now holds objects
parent
8110307b
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
42 additions
and
56 deletions
+42
-56
cms/djangoapps/contentstore/features/common.py
+6
-10
cms/djangoapps/contentstore/features/course-team.py
+2
-2
cms/djangoapps/contentstore/features/courses.py
+1
-1
cms/djangoapps/contentstore/features/grading.py
+1
-1
common/djangoapps/terrain/course_helpers.py
+1
-3
lms/djangoapps/courseware/features/common.py
+12
-16
lms/djangoapps/courseware/features/navigation.py
+6
-11
lms/djangoapps/courseware/features/problems.py
+7
-6
lms/djangoapps/courseware/features/registration.py
+2
-2
lms/djangoapps/courseware/features/video.py
+4
-4
No files found.
cms/djangoapps/contentstore/features/common.py
View file @
1f1bba55
...
...
@@ -147,22 +147,18 @@ def log_into_studio(
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
[
'username'
]
=
uname
world
.
scenario_dict
[
'userpassword'
]
=
password
world
.
scenario_dict
[
'useremail'
]
=
email
world
.
scenario_dict
[
'USER'
]
=
get_user_by_email
(
email
)
def
create_a_course
():
world
.
scenario_dict
[
'COURSE_NAME'
]
=
'Robot Super Course'
world
.
scenario_dict
[
'COURSE_NUM'
]
=
'999'
world
.
scenario_dict
[
'COURSE_ORG'
]
=
'MITx'
world
.
CourseFactory
.
create
(
org
=
world
.
scenario_dict
[
'COURSE_ORG'
],
course
=
world
.
scenario_dict
[
'COURSE_NUM'
],
display_name
=
world
.
scenario_dict
[
'COURSE_NAME'
])
world
.
scenario_dict
[
'COURSE'
]
=
world
.
CourseFactory
.
create
(
org
=
'MITx'
,
course
=
'999'
,
display_name
=
'Robot Super Course'
)
# Add the user to the instructor group of the course
# so they will have the permissions to see it in studio
course
=
world
.
GroupFactory
.
create
(
name
=
'instructor_MITx/{course_num}/{course_name}'
.
format
(
course_num
=
world
.
scenario_dict
[
'COURSE_NUM'
],
course_name
=
world
.
scenario_dict
[
'COURSE_NAME'
]
.
replace
(
" "
,
"_"
)))
if
world
.
scenario_dict
[
'useremail'
]:
user
=
get_user_by_email
(
world
.
scenario_dict
[
'useremail'
])
course
=
world
.
GroupFactory
.
create
(
name
=
'instructor_MITx/{course_num}/{course_name}'
.
format
(
course_num
=
world
.
scenario_dict
[
'COURSE'
]
.
number
,
course_name
=
world
.
scenario_dict
[
'COURSE_NAME'
]
.
display_name
.
replace
(
" "
,
"_"
)))
if
world
.
scenario_dict
[
'USER'
]:
user
=
world
.
scenario_dict
[
'USER'
]
else
:
user
=
get_user_by_email
(
'robot+studio@edx.org'
)
user
.
groups
.
add
(
course
)
...
...
cms/djangoapps/contentstore/features/course-team.py
View file @
1f1bba55
...
...
@@ -50,9 +50,9 @@ def see_course(_step, doesnt_see_course, gender):
all_courses
=
world
.
css_find
(
class_css
,
wait_time
=
1
)
all_names
=
[
item
.
html
for
item
in
all_courses
]
if
doesnt_see_course
:
assert
not
world
.
scenario_dict
[
'COURSE
_NAME'
]
in
all_names
assert
not
world
.
scenario_dict
[
'COURSE
'
]
.
display_name
in
all_names
else
:
assert
world
.
scenario_dict
[
'COURSE
_NAME'
]
in
all_names
assert
world
.
scenario_dict
[
'COURSE
'
]
.
display_name
in
all_names
@step
(
u's?he cannot delete users'
)
...
...
cms/djangoapps/contentstore/features/courses.py
View file @
1f1bba55
...
...
@@ -45,7 +45,7 @@ def courseware_page_has_loaded_in_studio(step):
@step
(
'I see the course listed in My Courses$'
)
def
i_see_the_course_in_my_courses
(
step
):
course_css
=
'span.class-name'
assert
world
.
css_has_text
(
course_css
,
world
.
scenario_dict
[
'COURSE
_NAME'
]
)
assert
world
.
css_has_text
(
course_css
,
world
.
scenario_dict
[
'COURSE
'
]
.
display_name
)
@step
(
'I am on the "([^"]*)" tab$'
)
...
...
cms/djangoapps/contentstore/features/grading.py
View file @
1f1bba55
...
...
@@ -64,7 +64,7 @@ def change_assignment_name(step, old_name, new_name):
@step
(
u'I go back to the main course page'
)
def
main_course_page
(
step
):
main_page_link_css
=
'a[href="/
%
s/
%
s/course/
%
s"]'
%
(
world
.
scenario_dict
[
'COURSE
_ORG'
],
world
.
scenario_dict
[
'COURSE_NUM'
],
world
.
scenario_dict
[
'COURSE_NAME'
]
.
replace
(
' '
,
'_'
),)
main_page_link_css
=
'a[href="/
%
s/
%
s/course/
%
s"]'
%
(
world
.
scenario_dict
[
'COURSE
'
]
.
org
,
world
.
scenario_dict
[
'COURSE'
]
.
number
,
world
.
scenario_dict
[
'COURSE'
]
.
display_name
.
replace
(
' '
,
'_'
),)
world
.
css_click
(
main_page_link_css
)
...
...
common/djangoapps/terrain/course_helpers.py
View file @
1f1bba55
...
...
@@ -43,7 +43,7 @@ def log_in(username, password):
"""
# Authenticate the user
user
=
authenticate
(
username
=
username
,
password
=
password
)
world
.
scenario_dict
[
'USER'
]
=
authenticate
(
username
=
username
,
password
=
password
)
assert
(
user
is
not
None
and
user
.
is_active
)
# Send a fake HttpRequest to log the user in
...
...
@@ -62,8 +62,6 @@ def log_in(username, password):
cookie_dict
=
{
settings
.
SESSION_COOKIE_NAME
:
request
.
session
.
session_key
}
world
.
browser
.
cookies
.
delete
()
world
.
browser
.
cookies
.
add
(
cookie_dict
)
world
.
scenario_dict
[
'username'
]
=
username
world
.
scenario_dict
[
'userpassword'
]
=
password
@world.absorb
...
...
lms/djangoapps/courseware/features/common.py
View file @
1f1bba55
...
...
@@ -21,10 +21,6 @@ logger = getLogger(__name__)
@step
(
u'The course "([^"]*)" exists$'
)
def
create_course
(
step
,
course
):
world
.
scenario_dict
[
'COURSE_NUM'
]
=
course
world
.
scenario_dict
[
'SECTION_NAME'
]
=
'Test Section'
world
.
scenario_dict
[
'COURSE_NAME'
]
=
'Test Course'
world
.
scenario_dict
[
'COURSE_ORG'
]
=
'edx'
# First clear the modulestore so we don't try to recreate
# the same course twice
...
...
@@ -34,17 +30,17 @@ def create_course(step, course):
# Create the course
# We always use the same org and display name,
# but vary the course identifier (e.g. 600x or 191x)
course
=
world
.
CourseFactory
.
create
(
org
=
world
.
scenario_dict
[
'COURSE_ORG'
]
,
world
.
scenario_dict
[
'COURSE'
]
=
world
.
CourseFactory
.
create
(
org
=
'edx'
,
number
=
course
,
display_name
=
world
.
scenario_dict
[
'COURSE_NAME'
]
)
display_name
=
'Test Course'
)
# Add a section to the course to contain problems
section
=
world
.
ItemFactory
.
create
(
parent_location
=
course
.
location
,
display_name
=
world
.
scenario_dict
[
'SECTION_NAME'
]
)
world
.
scenario_dict
[
'SECTION'
]
=
world
.
ItemFactory
.
create
(
parent_location
=
world
.
scenario_dict
[
'COURSE'
]
.
location
,
display_name
=
'Test Section'
)
problem_section
=
world
.
ItemFactory
.
create
(
parent_location
=
section
.
location
,
problem_section
=
world
.
ItemFactory
.
create
(
parent_location
=
world
.
scenario_dict
[
'SECTION'
]
.
location
,
template
=
'i4x://edx/templates/sequential/Empty'
,
display_name
=
world
.
scenario_dict
[
'SECTION_NAME'
]
)
display_name
=
'Test Section'
)
@step
(
u'I am registered for the course "([^"]*)"$'
)
...
...
@@ -71,24 +67,24 @@ def add_tab_to_course(step, course, extra_tab_name):
def
course_id
(
course_num
):
return
"
%
s/
%
s/
%
s"
%
(
world
.
scenario_dict
[
'COURSE
_ORG'
]
,
course_num
,
world
.
scenario_dict
[
'COURSE
_NAME'
]
.
replace
(
" "
,
"_"
))
return
"
%
s/
%
s/
%
s"
%
(
world
.
scenario_dict
[
'COURSE
'
]
.
org
,
course_num
,
world
.
scenario_dict
[
'COURSE
'
]
.
display_name
.
replace
(
" "
,
"_"
))
def
course_location
(
course_num
):
return
Location
(
loc_or_tag
=
"i4x"
,
org
=
world
.
scenario_dict
[
'COURSE
_ORG'
]
,
org
=
world
.
scenario_dict
[
'COURSE
'
]
.
org
,
course
=
course_num
,
category
=
'course'
,
name
=
world
.
scenario_dict
[
'COURSE
_NAME'
]
.
replace
(
" "
,
"_"
))
name
=
world
.
scenario_dict
[
'COURSE
'
]
.
display_name
.
replace
(
" "
,
"_"
))
def
section_location
(
course_num
):
return
Location
(
loc_or_tag
=
"i4x"
,
org
=
world
.
scenario_dict
[
'COURSE
_ORG'
]
,
org
=
world
.
scenario_dict
[
'COURSE
'
]
.
org
,
course
=
course_num
,
category
=
'sequential'
,
name
=
world
.
scenario_dict
[
'SECTION
_NAME'
]
.
replace
(
" "
,
"_"
))
name
=
world
.
scenario_dict
[
'SECTION
'
]
.
display_name
.
replace
(
" "
,
"_"
))
def
get_courses
():
...
...
lms/djangoapps/courseware/features/navigation.py
View file @
1f1bba55
...
...
@@ -16,11 +16,11 @@ TEST_SUBSECTION_NAME = 'Test Subsection'
def
view_course_multiple_sections
(
step
):
create_course
()
# Add a section to the course to contain problems
section1
=
world
.
ItemFactory
.
create
(
parent_location
=
course_location
(
world
.
scenario_dict
[
'COURSE
_NUM'
]
),
section1
=
world
.
ItemFactory
.
create
(
parent_location
=
course_location
(
world
.
scenario_dict
[
'COURSE
'
]
.
number
),
display_name
=
section_name
(
1
))
# Add a section to the course to contain problems
section2
=
world
.
ItemFactory
.
create
(
parent_location
=
course_location
(
world
.
scenario_dict
[
'COURSE
_NUM'
]
),
section2
=
world
.
ItemFactory
.
create
(
parent_location
=
course_location
(
world
.
scenario_dict
[
'COURSE
'
]
.
number
),
display_name
=
section_name
(
2
))
place1
=
world
.
ItemFactory
.
create
(
parent_location
=
section1
.
location
,
...
...
@@ -42,7 +42,7 @@ def view_course_multiple_subsections(step):
create_course
()
# Add a section to the course to contain problems
section1
=
world
.
ItemFactory
.
create
(
parent_location
=
course_location
(
world
.
scenario_dict
[
'COURSE
_NUM'
]
),
section1
=
world
.
ItemFactory
.
create
(
parent_location
=
course_location
(
world
.
scenario_dict
[
'COURSE
'
]
.
number
),
display_name
=
section_name
(
1
))
place1
=
world
.
ItemFactory
.
create
(
parent_location
=
section1
.
location
,
...
...
@@ -62,7 +62,7 @@ def view_course_multiple_subsections(step):
def
view_course_multiple_sequences
(
step
):
create_course
()
# Add a section to the course to contain problems
section1
=
world
.
ItemFactory
.
create
(
parent_location
=
course_location
(
world
.
scenario_dict
[
'COURSE
_NUM'
]
),
section1
=
world
.
ItemFactory
.
create
(
parent_location
=
course_location
(
world
.
scenario_dict
[
'COURSE
'
]
.
number
),
display_name
=
section_name
(
1
))
place1
=
world
.
ItemFactory
.
create
(
parent_location
=
section1
.
location
,
...
...
@@ -142,19 +142,14 @@ def subsection_name(section):
def
create_course
():
world
.
clear_courses
()
world
.
scenario_dict
[
'COURSE_NAME'
]
=
'Test Course'
world
.
scenario_dict
[
'COURSE_ORG'
]
=
'edx'
world
.
scenario_dict
[
'COURSE_NUM'
]
=
'model_course'
world
.
CourseFactory
.
create
(
org
=
world
.
scenario_dict
[
'COURSE_ORG'
],
number
=
world
.
scenario_dict
[
'COURSE_NUM'
],
display_name
=
world
.
scenario_dict
[
'COURSE_NAME'
])
world
.
scenario_dict
[
'COURSE'
]
=
world
.
CourseFactory
.
create
(
org
=
'edx'
,
number
=
'model_course'
,
display_name
=
'Test Course'
)
def
create_user_and_visit_course
():
world
.
create_user
(
'robot'
,
'test'
)
u
=
User
.
objects
.
get
(
username
=
'robot'
)
CourseEnrollment
.
objects
.
get_or_create
(
user
=
u
,
course_id
=
course_id
(
world
.
scenario_dict
[
'COURSE
_NUM'
]
))
CourseEnrollment
.
objects
.
get_or_create
(
user
=
u
,
course_id
=
course_id
(
world
.
scenario_dict
[
'COURSE
'
]
.
number
))
world
.
log_in
(
'robot'
,
'test'
)
chapter_name
=
(
TEST_SECTION_NAME
+
"1"
)
.
replace
(
" "
,
"_"
)
...
...
lms/djangoapps/courseware/features/problems.py
View file @
1f1bba55
...
...
@@ -17,14 +17,15 @@ def view_problem_with_attempts(step, problem_type, attempts):
i_am_registered_for_the_course
(
step
,
'model_course'
)
# Ensure that the course has this problem type
add_problem_to_course
(
world
.
scenario_dict
[
'COURSE
_NUM'
]
,
problem_type
,
{
'attempts'
:
attempts
})
add_problem_to_course
(
world
.
scenario_dict
[
'COURSE
'
]
.
number
,
problem_type
,
{
'attempts'
:
attempts
})
# Go to the one section in the factory-created course
# which should be loaded with the correct problem
chapter_name
=
world
.
scenario_dict
[
'SECTION_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_NUM'
],
world
.
scenario_dict
[
'COURSE_NAME'
]
.
replace
(
' '
,
'_'
),
chapter_name
,
section_name
,))
(
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
)
...
...
@@ -40,8 +41,8 @@ def view_problem_with_show_answer(step, problem_type, answer):
chapter_name
=
world
.
scenario_dict
[
'SECTION_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_NUM'
],
world
.
scenario_dict
[
'COURSE_NAME'
]
.
replace
(
' '
,
'_'
),
chapter_name
,
section_name
,))
(
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
)
...
...
@@ -57,8 +58,8 @@ def view_problem(step, problem_type):
chapter_name
=
world
.
scenario_dict
[
'SECTION_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_NUM'
],
world
.
scenario_dict
[
'COURSE_NAME'
]
.
replace
(
' '
,
'_'
),
chapter_name
,
section_name
,))
(
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
)
...
...
lms/djangoapps/courseware/features/registration.py
View file @
1f1bba55
...
...
@@ -7,8 +7,8 @@ from lettuce.django import django_url
@step
(
'I register for the course "([^"]*)"$'
)
def
i_register_for_the_course
(
_step
,
course
):
cleaned_name
=
world
.
scenario_dict
[
'COURSE
_NAME'
]
.
replace
(
' '
,
'_'
)
url
=
django_url
(
'courses/
%
s/
%
s/
%
s/about'
%
(
world
.
scenario_dict
[
'COURSE
_ORG'
]
,
course
,
cleaned_name
))
cleaned_name
=
world
.
scenario_dict
[
'COURSE
'
]
.
display_name
.
replace
(
' '
,
'_'
)
url
=
django_url
(
'courses/
%
s/
%
s/
%
s/about'
%
(
world
.
scenario_dict
[
'COURSE
'
]
.
org
,
course
,
cleaned_name
))
world
.
browser
.
visit
(
url
)
world
.
css_click
(
'section.intro a.register'
)
...
...
lms/djangoapps/courseware/features/video.py
View file @
1f1bba55
...
...
@@ -22,8 +22,8 @@ def view_video(_step):
chapter_name
=
world
.
scenario_dict
[
'SECTION_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_NUM'
],
world
.
scenario_dict
[
'COURSE_NAME'
]
.
replace
(
' '
,
'_'
),
chapter_name
,
section_name
,))
(
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
)
...
...
@@ -37,8 +37,8 @@ def view_videoalpha(step):
chapter_name
=
world
.
scenario_dict
[
'SECTION_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_NUM'
],
world
.
scenario_dict
[
'COURSE_NAME'
]
.
replace
(
' '
,
'_'
),
chapter_name
,
section_name
,))
(
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
)
...
...
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