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
568f557d
Commit
568f557d
authored
Mar 18, 2013
by
Will Daly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pep8 fixes
Changed constant to uppercase
parent
5fd1e742
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
47 additions
and
23 deletions
+47
-23
common/djangoapps/terrain/browser.py
+1
-0
common/djangoapps/terrain/factories.py
+0
-0
common/djangoapps/terrain/steps.py
+1
-0
common/lib/capa/capa/tests/response_xml_factory.py
+16
-8
lms/djangoapps/courseware/features/common.py
+6
-0
lms/djangoapps/courseware/features/courses.py
+1
-0
lms/djangoapps/courseware/features/high-level-tabs.feature
+1
-1
lms/djangoapps/courseware/features/homepage.feature
+0
-0
lms/djangoapps/courseware/features/login.py
+1
-0
lms/djangoapps/courseware/features/openended.feature
+0
-0
lms/djangoapps/courseware/features/problems.feature
+0
-0
lms/djangoapps/courseware/features/problems.py
+19
-14
lms/djangoapps/courseware/features/registration.py
+1
-0
lms/djangoapps/courseware/features/smart-accordion.feature
+0
-0
No files found.
common/djangoapps/terrain/browser.py
View file @
568f557d
...
@@ -21,6 +21,7 @@ def initial_setup(server):
...
@@ -21,6 +21,7 @@ def initial_setup(server):
# world.browser = Browser('phantomjs')
# world.browser = Browser('phantomjs')
# world.browser = Browser('firefox')
# world.browser = Browser('firefox')
@before.each_scenario
@before.each_scenario
def
reset_data
(
scenario
):
def
reset_data
(
scenario
):
# Clean out the django test database defined in the
# Clean out the django test database defined in the
...
...
common/djangoapps/terrain/factories.py
View file @
568f557d
common/djangoapps/terrain/steps.py
View file @
568f557d
...
@@ -101,6 +101,7 @@ def i_am_an_edx_user(step):
...
@@ -101,6 +101,7 @@ def i_am_an_edx_user(step):
#### helper functions
#### helper functions
@world.absorb
@world.absorb
def
scroll_to_bottom
():
def
scroll_to_bottom
():
# Maximize the browser
# Maximize the browser
...
...
common/lib/capa/capa/tests/response_xml_factory.py
View file @
568f557d
from
lxml
import
etree
from
lxml
import
etree
from
abc
import
ABCMeta
,
abstractmethod
from
abc
import
ABCMeta
,
abstractmethod
class
ResponseXMLFactory
(
object
):
class
ResponseXMLFactory
(
object
):
""" Abstract base class for capa response XML factories.
""" Abstract base class for capa response XML factories.
Subclasses override create_response_element and
Subclasses override create_response_element and
...
@@ -135,7 +136,7 @@ class ResponseXMLFactory(object):
...
@@ -135,7 +136,7 @@ class ResponseXMLFactory(object):
# Names of group elements
# Names of group elements
group_element_names
=
{
'checkbox'
:
'checkboxgroup'
,
group_element_names
=
{
'checkbox'
:
'checkboxgroup'
,
'radio'
:
'radiogroup'
,
'radio'
:
'radiogroup'
,
'multiple'
:
'choicegroup'
}
'multiple'
:
'choicegroup'
}
# Retrieve **kwargs
# Retrieve **kwargs
choices
=
kwargs
.
get
(
'choices'
,
[
True
])
choices
=
kwargs
.
get
(
'choices'
,
[
True
])
...
@@ -272,6 +273,7 @@ class SchematicResponseXMLFactory(ResponseXMLFactory):
...
@@ -272,6 +273,7 @@ class SchematicResponseXMLFactory(ResponseXMLFactory):
For testing, we create a bare-bones version of <schematic>."""
For testing, we create a bare-bones version of <schematic>."""
return
etree
.
Element
(
"schematic"
)
return
etree
.
Element
(
"schematic"
)
class
CodeResponseXMLFactory
(
ResponseXMLFactory
):
class
CodeResponseXMLFactory
(
ResponseXMLFactory
):
""" Factory for creating <coderesponse> XML trees """
""" Factory for creating <coderesponse> XML trees """
...
@@ -326,6 +328,7 @@ class CodeResponseXMLFactory(ResponseXMLFactory):
...
@@ -326,6 +328,7 @@ class CodeResponseXMLFactory(ResponseXMLFactory):
# return None here
# return None here
return
None
return
None
class
ChoiceResponseXMLFactory
(
ResponseXMLFactory
):
class
ChoiceResponseXMLFactory
(
ResponseXMLFactory
):
""" Factory for creating <choiceresponse> XML trees """
""" Factory for creating <choiceresponse> XML trees """
...
@@ -438,6 +441,7 @@ class FormulaResponseXMLFactory(ResponseXMLFactory):
...
@@ -438,6 +441,7 @@ class FormulaResponseXMLFactory(ResponseXMLFactory):
"#"
+
str
(
num_samples
))
"#"
+
str
(
num_samples
))
return
sample_str
return
sample_str
class
ImageResponseXMLFactory
(
ResponseXMLFactory
):
class
ImageResponseXMLFactory
(
ResponseXMLFactory
):
""" Factory for producing <imageresponse> XML """
""" Factory for producing <imageresponse> XML """
...
@@ -497,6 +501,7 @@ class ImageResponseXMLFactory(ResponseXMLFactory):
...
@@ -497,6 +501,7 @@ class ImageResponseXMLFactory(ResponseXMLFactory):
return
input_element
return
input_element
class
JavascriptResponseXMLFactory
(
ResponseXMLFactory
):
class
JavascriptResponseXMLFactory
(
ResponseXMLFactory
):
""" Factory for producing <javascriptresponse> XML """
""" Factory for producing <javascriptresponse> XML """
...
@@ -550,6 +555,7 @@ class JavascriptResponseXMLFactory(ResponseXMLFactory):
...
@@ -550,6 +555,7 @@ class JavascriptResponseXMLFactory(ResponseXMLFactory):
""" Create the <javascriptinput> element """
""" Create the <javascriptinput> element """
return
etree
.
Element
(
"javascriptinput"
)
return
etree
.
Element
(
"javascriptinput"
)
class
MultipleChoiceResponseXMLFactory
(
ResponseXMLFactory
):
class
MultipleChoiceResponseXMLFactory
(
ResponseXMLFactory
):
""" Factory for producing <multiplechoiceresponse> XML """
""" Factory for producing <multiplechoiceresponse> XML """
...
@@ -562,6 +568,7 @@ class MultipleChoiceResponseXMLFactory(ResponseXMLFactory):
...
@@ -562,6 +568,7 @@ class MultipleChoiceResponseXMLFactory(ResponseXMLFactory):
kwargs
[
'choice_type'
]
=
'multiple'
kwargs
[
'choice_type'
]
=
'multiple'
return
ResponseXMLFactory
.
choicegroup_input_xml
(
**
kwargs
)
return
ResponseXMLFactory
.
choicegroup_input_xml
(
**
kwargs
)
class
TrueFalseResponseXMLFactory
(
ResponseXMLFactory
):
class
TrueFalseResponseXMLFactory
(
ResponseXMLFactory
):
""" Factory for producing <truefalseresponse> XML """
""" Factory for producing <truefalseresponse> XML """
...
@@ -574,6 +581,7 @@ class TrueFalseResponseXMLFactory(ResponseXMLFactory):
...
@@ -574,6 +581,7 @@ class TrueFalseResponseXMLFactory(ResponseXMLFactory):
kwargs
[
'choice_type'
]
=
'multiple'
kwargs
[
'choice_type'
]
=
'multiple'
return
ResponseXMLFactory
.
choicegroup_input_xml
(
**
kwargs
)
return
ResponseXMLFactory
.
choicegroup_input_xml
(
**
kwargs
)
class
OptionResponseXMLFactory
(
ResponseXMLFactory
):
class
OptionResponseXMLFactory
(
ResponseXMLFactory
):
""" Factory for producing <optionresponse> XML"""
""" Factory for producing <optionresponse> XML"""
...
@@ -665,6 +673,7 @@ class StringResponseXMLFactory(ResponseXMLFactory):
...
@@ -665,6 +673,7 @@ class StringResponseXMLFactory(ResponseXMLFactory):
def
create_input_element
(
self
,
**
kwargs
):
def
create_input_element
(
self
,
**
kwargs
):
return
ResponseXMLFactory
.
textline_input_xml
(
**
kwargs
)
return
ResponseXMLFactory
.
textline_input_xml
(
**
kwargs
)
class
AnnotationResponseXMLFactory
(
ResponseXMLFactory
):
class
AnnotationResponseXMLFactory
(
ResponseXMLFactory
):
""" Factory for creating <annotationresponse> XML trees """
""" Factory for creating <annotationresponse> XML trees """
def
create_response_element
(
self
,
**
kwargs
):
def
create_response_element
(
self
,
**
kwargs
):
...
@@ -677,17 +686,17 @@ class AnnotationResponseXMLFactory(ResponseXMLFactory):
...
@@ -677,17 +686,17 @@ class AnnotationResponseXMLFactory(ResponseXMLFactory):
input_element
=
etree
.
Element
(
"annotationinput"
)
input_element
=
etree
.
Element
(
"annotationinput"
)
text_children
=
[
text_children
=
[
{
'tag'
:
'title'
,
'text'
:
kwargs
.
get
(
'title'
,
'super cool annotation'
)
},
{
'tag'
:
'title'
,
'text'
:
kwargs
.
get
(
'title'
,
'super cool annotation'
)},
{
'tag'
:
'text'
,
'text'
:
kwargs
.
get
(
'text'
,
'texty text'
)
},
{
'tag'
:
'text'
,
'text'
:
kwargs
.
get
(
'text'
,
'texty text'
)},
{
'tag'
:
'comment'
,
'text'
:
kwargs
.
get
(
'comment'
,
'blah blah erudite comment blah blah'
)
},
{
'tag'
:
'comment'
,
'text'
:
kwargs
.
get
(
'comment'
,
'blah blah erudite comment blah blah'
)},
{
'tag'
:
'comment_prompt'
,
'text'
:
kwargs
.
get
(
'comment_prompt'
,
'type a commentary below'
)
},
{
'tag'
:
'comment_prompt'
,
'text'
:
kwargs
.
get
(
'comment_prompt'
,
'type a commentary below'
)},
{
'tag'
:
'tag_prompt'
,
'text'
:
kwargs
.
get
(
'tag_prompt'
,
'select one tag'
)
}
{
'tag'
:
'tag_prompt'
,
'text'
:
kwargs
.
get
(
'tag_prompt'
,
'select one tag'
)}
]
]
for
child
in
text_children
:
for
child
in
text_children
:
etree
.
SubElement
(
input_element
,
child
[
'tag'
])
.
text
=
child
[
'text'
]
etree
.
SubElement
(
input_element
,
child
[
'tag'
])
.
text
=
child
[
'text'
]
default_options
=
[(
'green'
,
'correct'
),(
'eggs'
,
'incorrect'
),(
'ham'
,
'partially-correct'
)]
default_options
=
[(
'green'
,
'correct'
),(
'eggs'
,
'incorrect'
),
(
'ham'
,
'partially-correct'
)]
options
=
kwargs
.
get
(
'options'
,
default_options
)
options
=
kwargs
.
get
(
'options'
,
default_options
)
options_element
=
etree
.
SubElement
(
input_element
,
'options'
)
options_element
=
etree
.
SubElement
(
input_element
,
'options'
)
...
@@ -696,4 +705,3 @@ class AnnotationResponseXMLFactory(ResponseXMLFactory):
...
@@ -696,4 +705,3 @@ class AnnotationResponseXMLFactory(ResponseXMLFactory):
option_element
.
text
=
description
option_element
.
text
=
description
return
input_element
return
input_element
lms/djangoapps/courseware/features/common.py
View file @
568f557d
...
@@ -89,6 +89,7 @@ TEST_COURSE_ORG = 'edx'
...
@@ -89,6 +89,7 @@ TEST_COURSE_ORG = 'edx'
TEST_COURSE_NAME
=
'Test Course'
TEST_COURSE_NAME
=
'Test Course'
TEST_SECTION_NAME
=
"Problem"
TEST_SECTION_NAME
=
"Problem"
@step
(
u'The course "([^"]*)" exists$'
)
@step
(
u'The course "([^"]*)" exists$'
)
def
create_course
(
step
,
course
):
def
create_course
(
step
,
course
):
...
@@ -112,6 +113,7 @@ def create_course(step, course):
...
@@ -112,6 +113,7 @@ def create_course(step, course):
template
=
'i4x://edx/templates/sequential/Empty'
,
template
=
'i4x://edx/templates/sequential/Empty'
,
display_name
=
TEST_SECTION_NAME
)
display_name
=
TEST_SECTION_NAME
)
@step
(
u'I am registered for the course "([^"]*)"$'
)
@step
(
u'I am registered for the course "([^"]*)"$'
)
def
i_am_registered_for_the_course
(
step
,
course
):
def
i_am_registered_for_the_course
(
step
,
course
):
# Create the course
# Create the course
...
@@ -126,6 +128,7 @@ def i_am_registered_for_the_course(step, course):
...
@@ -126,6 +128,7 @@ def i_am_registered_for_the_course(step, course):
world
.
log_in
(
'robot@edx.org'
,
'test'
)
world
.
log_in
(
'robot@edx.org'
,
'test'
)
@step
(
u'The course "([^"]*)" has extra tab "([^"]*)"$'
)
@step
(
u'The course "([^"]*)" has extra tab "([^"]*)"$'
)
def
add_tab_to_course
(
step
,
course
,
extra_tab_name
):
def
add_tab_to_course
(
step
,
course
,
extra_tab_name
):
section_item
=
ItemFactory
.
create
(
parent_location
=
course_location
(
course
),
section_item
=
ItemFactory
.
create
(
parent_location
=
course_location
(
course
),
...
@@ -155,10 +158,12 @@ def flush_xmodule_store():
...
@@ -155,10 +158,12 @@ def flush_xmodule_store():
modulestore
()
.
collection
.
drop
()
modulestore
()
.
collection
.
drop
()
update_templates
()
update_templates
()
def
course_id
(
course_num
):
def
course_id
(
course_num
):
return
"
%
s/
%
s/
%
s"
%
(
TEST_COURSE_ORG
,
course_num
,
return
"
%
s/
%
s/
%
s"
%
(
TEST_COURSE_ORG
,
course_num
,
TEST_COURSE_NAME
.
replace
(
" "
,
"_"
))
TEST_COURSE_NAME
.
replace
(
" "
,
"_"
))
def
course_location
(
course_num
):
def
course_location
(
course_num
):
return
Location
(
loc_or_tag
=
"i4x"
,
return
Location
(
loc_or_tag
=
"i4x"
,
org
=
TEST_COURSE_ORG
,
org
=
TEST_COURSE_ORG
,
...
@@ -166,6 +171,7 @@ def course_location(course_num):
...
@@ -166,6 +171,7 @@ def course_location(course_num):
category
=
'course'
,
category
=
'course'
,
name
=
TEST_COURSE_NAME
.
replace
(
" "
,
"_"
))
name
=
TEST_COURSE_NAME
.
replace
(
" "
,
"_"
))
def
section_location
(
course_num
):
def
section_location
(
course_num
):
return
Location
(
loc_or_tag
=
"i4x"
,
return
Location
(
loc_or_tag
=
"i4x"
,
org
=
TEST_COURSE_ORG
,
org
=
TEST_COURSE_ORG
,
...
...
lms/djangoapps/courseware/features/courses.py
View file @
568f557d
...
@@ -9,6 +9,7 @@ logger = getLogger(__name__)
...
@@ -9,6 +9,7 @@ logger = getLogger(__name__)
## support functions
## support functions
def
get_courses
():
def
get_courses
():
'''
'''
Returns dict of lists of courses available, keyed by course.org (ie university).
Returns dict of lists of courses available, keyed by course.org (ie university).
...
...
lms/djangoapps/courseware/features/high-level-tabs.feature
View file @
568f557d
...
@@ -3,7 +3,7 @@ Feature: All the high level tabs should work
...
@@ -3,7 +3,7 @@ Feature: All the high level tabs should work
As a student
As a student
I want to navigate through the high level tabs
I want to navigate through the high level tabs
Scenario
:
I
can navigate to all high-level tabs in a course
Scenario
:
I
can navigate to all high
-level tabs in a course
Given
:
I
am registered for the course
"6.002x"
Given
:
I
am registered for the course
"6.002x"
And
The course
"6.002x"
has extra tab
"Custom Tab"
And
The course
"6.002x"
has extra tab
"Custom Tab"
And
I log in
And
I log in
...
...
lms/djangoapps/courseware/features/homepage.feature
View file @
568f557d
lms/djangoapps/courseware/features/login.py
View file @
568f557d
...
@@ -34,6 +34,7 @@ def click_the_dropdown(step):
...
@@ -34,6 +34,7 @@ def click_the_dropdown(step):
#### helper functions
#### helper functions
def
user_is_an_unactivated_user
(
uname
):
def
user_is_an_unactivated_user
(
uname
):
u
=
User
.
objects
.
get
(
username
=
uname
)
u
=
User
.
objects
.
get
(
username
=
uname
)
u
.
is_active
=
False
u
.
is_active
=
False
...
...
lms/djangoapps/courseware/features/openended.feature
View file @
568f557d
lms/djangoapps/courseware/features/problems.feature
View file @
568f557d
lms/djangoapps/courseware/features/problems.py
View file @
568f557d
...
@@ -13,7 +13,7 @@ from capa.tests.response_xml_factory import OptionResponseXMLFactory, \
...
@@ -13,7 +13,7 @@ from capa.tests.response_xml_factory import OptionResponseXMLFactory, \
# Factories from capa.tests.response_xml_factory that we will use
# Factories from capa.tests.response_xml_factory that we will use
# to generate the problem XML, with the keyword args used to configure
# to generate the problem XML, with the keyword args used to configure
# the output.
# the output.
problem_factory_dict
=
{
PROBLEM_FACTORY_DICT
=
{
'drop down'
:
{
'drop down'
:
{
'factory'
:
OptionResponseXMLFactory
(),
'factory'
:
OptionResponseXMLFactory
(),
'kwargs'
:
{
'kwargs'
:
{
...
@@ -32,8 +32,8 @@ problem_factory_dict = {
...
@@ -32,8 +32,8 @@ problem_factory_dict = {
'factory'
:
ChoiceResponseXMLFactory
(),
'factory'
:
ChoiceResponseXMLFactory
(),
'kwargs'
:
{
'kwargs'
:
{
'question_text'
:
'The correct answer is Choices 1 and 3'
,
'question_text'
:
'The correct answer is Choices 1 and 3'
,
'choice_type'
:
'checkbox'
,
'choice_type'
:
'checkbox'
,
'choices'
:[
True
,
False
,
True
,
False
,
False
],
'choices'
:
[
True
,
False
,
True
,
False
,
False
],
'choice_names'
:
[
'Choice 1'
,
'Choice 2'
,
'Choice 3'
,
'Choice 4'
]}},
'choice_names'
:
[
'Choice 1'
,
'Choice 2'
,
'Choice 3'
,
'Choice 4'
]}},
'string'
:
{
'string'
:
{
...
@@ -41,7 +41,7 @@ problem_factory_dict = {
...
@@ -41,7 +41,7 @@ problem_factory_dict = {
'kwargs'
:
{
'kwargs'
:
{
'question_text'
:
'The answer is "correct string"'
,
'question_text'
:
'The answer is "correct string"'
,
'case_sensitive'
:
False
,
'case_sensitive'
:
False
,
'answer'
:
'correct string'
}},
'answer'
:
'correct string'
}},
'numerical'
:
{
'numerical'
:
{
'factory'
:
NumericalResponseXMLFactory
(),
'factory'
:
NumericalResponseXMLFactory
(),
...
@@ -49,13 +49,13 @@ problem_factory_dict = {
...
@@ -49,13 +49,13 @@ problem_factory_dict = {
'question_text'
:
'The answer is pi + 1'
,
'question_text'
:
'The answer is pi + 1'
,
'answer'
:
'4.14159'
,
'answer'
:
'4.14159'
,
'tolerance'
:
'0.00001'
,
'tolerance'
:
'0.00001'
,
'math_display'
:
True
}},
'math_display'
:
True
}},
'formula'
:
{
'formula'
:
{
'factory'
:
FormulaResponseXMLFactory
(),
'factory'
:
FormulaResponseXMLFactory
(),
'kwargs'
:
{
'kwargs'
:
{
'question_text'
:
'The solution is [mathjax]x^2+2x+y[/mathjax]'
,
'question_text'
:
'The solution is [mathjax]x^2+2x+y[/mathjax]'
,
'sample_dict'
:
{
'x'
:
(
-
100
,
100
),
'y'
:
(
-
100
,
100
)
},
'sample_dict'
:
{
'x'
:
(
-
100
,
100
),
'y'
:
(
-
100
,
100
)},
'num_samples'
:
10
,
'num_samples'
:
10
,
'tolerance'
:
0.00001
,
'tolerance'
:
0.00001
,
'math_display'
:
True
,
'math_display'
:
True
,
...
@@ -77,15 +77,16 @@ problem_factory_dict = {
...
@@ -77,15 +77,16 @@ problem_factory_dict = {
a1=0
a1=0
a2=0
a2=0
return (a1+a2)==int(expect)
return (a1+a2)==int(expect)
"""
)
}},
"""
)}},
}
}
def
add_problem_to_course
(
course
,
problem_type
):
def
add_problem_to_course
(
course
,
problem_type
):
assert
(
problem_type
in
problem_factory_dict
)
assert
(
problem_type
in
PROBLEM_FACTORY_DICT
)
# Generate the problem XML using capa.tests.response_xml_factory
# Generate the problem XML using capa.tests.response_xml_factory
factory_dict
=
problem_factory_dict
[
problem_type
]
factory_dict
=
PROBLEM_FACTORY_DICT
[
problem_type
]
problem_xml
=
factory_dict
[
'factory'
]
.
build_xml
(
**
factory_dict
[
'kwargs'
])
problem_xml
=
factory_dict
[
'factory'
]
.
build_xml
(
**
factory_dict
[
'kwargs'
])
# Create a problem item using our generated XML
# Create a problem item using our generated XML
...
@@ -95,7 +96,8 @@ def add_problem_to_course(course, problem_type):
...
@@ -95,7 +96,8 @@ def add_problem_to_course(course, problem_type):
template
=
"i4x://edx/templates/problem/Blank_Common_Problem"
,
template
=
"i4x://edx/templates/problem/Blank_Common_Problem"
,
display_name
=
str
(
problem_type
),
display_name
=
str
(
problem_type
),
data
=
problem_xml
,
data
=
problem_xml
,
metadata
=
{
'rerandomize'
:
'always'
})
metadata
=
{
'rerandomize'
:
'always'
})
@step
(
u'I am viewing a "([^"]*)" problem'
)
@step
(
u'I am viewing a "([^"]*)" problem'
)
def
view_problem
(
step
,
problem_type
):
def
view_problem
(
step
,
problem_type
):
...
@@ -147,7 +149,7 @@ def answer_problem(step, problem_type, correctness):
...
@@ -147,7 +149,7 @@ def answer_problem(step, problem_type, correctness):
inputfield
(
'string'
)
.
fill
(
textvalue
)
inputfield
(
'string'
)
.
fill
(
textvalue
)
elif
problem_type
==
'numerical'
:
elif
problem_type
==
'numerical'
:
textvalue
=
"pi + 1"
if
correctness
==
'correct'
else
str
(
random
.
randint
(
-
2
,
2
))
textvalue
=
"pi + 1"
if
correctness
==
'correct'
else
str
(
random
.
randint
(
-
2
,
2
))
inputfield
(
'numerical'
)
.
fill
(
textvalue
)
inputfield
(
'numerical'
)
.
fill
(
textvalue
)
elif
problem_type
==
'formula'
:
elif
problem_type
==
'formula'
:
...
@@ -170,14 +172,17 @@ def answer_problem(step, problem_type, correctness):
...
@@ -170,14 +172,17 @@ def answer_problem(step, problem_type, correctness):
# Submit the problem
# Submit the problem
check_problem
(
step
)
check_problem
(
step
)
@step
(
u'I check a problem'
)
@step
(
u'I check a problem'
)
def
check_problem
(
step
):
def
check_problem
(
step
):
world
.
browser
.
find_by_css
(
"input.check"
)
.
click
()
world
.
browser
.
find_by_css
(
"input.check"
)
.
click
()
@step
(
u'I reset the problem'
)
@step
(
u'I reset the problem'
)
def
reset_problem
(
step
):
def
reset_problem
(
step
):
world
.
browser
.
find_by_css
(
'input.reset'
)
.
click
()
world
.
browser
.
find_by_css
(
'input.reset'
)
.
click
()
@step
(
u'My "([^"]*)" answer is marked "([^"]*)"'
)
@step
(
u'My "([^"]*)" answer is marked "([^"]*)"'
)
def
assert_answer_mark
(
step
,
problem_type
,
correctness
):
def
assert_answer_mark
(
step
,
problem_type
,
correctness
):
""" Assert that the expected answer mark is visible for a given problem type.
""" Assert that the expected answer mark is visible for a given problem type.
...
@@ -196,7 +201,7 @@ def assert_answer_mark(step, problem_type, correctness):
...
@@ -196,7 +201,7 @@ def assert_answer_mark(step, problem_type, correctness):
# For example, multiple choice is marked incorrect differently
# For example, multiple choice is marked incorrect differently
# depending on whether the user selects an incorrect
# depending on whether the user selects an incorrect
# item or submits without selecting any item)
# item or submits without selecting any item)
correct_selectors
=
{
'drop down'
:
[
'span.correct'
],
correct_selectors
=
{
'drop down'
:
[
'span.correct'
],
'multiple choice'
:
[
'label.choicegroup_correct'
],
'multiple choice'
:
[
'label.choicegroup_correct'
],
'checkbox'
:
[
'span.correct'
],
'checkbox'
:
[
'span.correct'
],
'string'
:
[
'div.correct'
],
'string'
:
[
'div.correct'
],
...
@@ -204,14 +209,14 @@ def assert_answer_mark(step, problem_type, correctness):
...
@@ -204,14 +209,14 @@ def assert_answer_mark(step, problem_type, correctness):
'formula'
:
[
'div.correct'
],
'formula'
:
[
'div.correct'
],
'script'
:
[
'div.correct'
],
}
'script'
:
[
'div.correct'
],
}
incorrect_selectors
=
{
'drop down'
:
[
'span.incorrect'
],
incorrect_selectors
=
{
'drop down'
:
[
'span.incorrect'
],
'multiple choice'
:
[
'label.choicegroup_incorrect'
,
'multiple choice'
:
[
'label.choicegroup_incorrect'
,
'span.incorrect'
],
'span.incorrect'
],
'checkbox'
:
[
'span.incorrect'
],
'checkbox'
:
[
'span.incorrect'
],
'string'
:
[
'div.incorrect'
],
'string'
:
[
'div.incorrect'
],
'numerical'
:
[
'div.incorrect'
],
'numerical'
:
[
'div.incorrect'
],
'formula'
:
[
'div.incorrect'
],
'formula'
:
[
'div.incorrect'
],
'script'
:
[
'div.incorrect'
]
}
'script'
:
[
'div.incorrect'
]}
assert
(
correctness
in
[
'correct'
,
'incorrect'
,
'unanswered'
])
assert
(
correctness
in
[
'correct'
,
'incorrect'
,
'unanswered'
])
assert
(
problem_type
in
correct_selectors
and
problem_type
in
incorrect_selectors
)
assert
(
problem_type
in
correct_selectors
and
problem_type
in
incorrect_selectors
)
...
...
lms/djangoapps/courseware/features/registration.py
View file @
568f557d
...
@@ -2,6 +2,7 @@ from lettuce import world, step
...
@@ -2,6 +2,7 @@ from lettuce import world, step
from
lettuce.django
import
django_url
from
lettuce.django
import
django_url
from
common
import
TEST_COURSE_ORG
,
TEST_COURSE_NAME
from
common
import
TEST_COURSE_ORG
,
TEST_COURSE_NAME
@step
(
'I register for the course "([^"]*)"$'
)
@step
(
'I register for the course "([^"]*)"$'
)
def
i_register_for_the_course
(
step
,
course
):
def
i_register_for_the_course
(
step
,
course
):
cleaned_name
=
TEST_COURSE_NAME
.
replace
(
' '
,
'_'
)
cleaned_name
=
TEST_COURSE_NAME
.
replace
(
' '
,
'_'
)
...
...
lms/djangoapps/courseware/features/smart-accordion.feature
View file @
568f557d
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