Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
problem-builder
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
OpenEdx
problem-builder
Commits
bb742269
Commit
bb742269
authored
Sep 20, 2014
by
dragonfi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pep8
parent
1c2b94dc
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
19 additions
and
17 deletions
+19
-17
mentoring/questionnaire.py
+1
-1
mentoring/table.py
+4
-5
mentoring/test_base.py
+1
-2
mentoring/tip.py
+1
-2
mentoring/title.py
+1
-0
tests/integration/test_answer.py
+0
-1
tests/integration/test_progression.py
+3
-1
tests/integration/test_table.py
+0
-1
tests/unit/test_step.py
+8
-4
No files found.
mentoring/questionnaire.py
View file @
bb742269
...
@@ -77,7 +77,7 @@ class QuestionnaireAbstractBlock(LightChild, StepMixin):
...
@@ -77,7 +77,7 @@ class QuestionnaireAbstractBlock(LightChild, StepMixin):
name
=
self
.
__class__
.
__name__
name
=
self
.
__class__
.
__name__
if
str
(
self
.
type
)
not
in
self
.
valid_types
:
if
str
(
self
.
type
)
not
in
self
.
valid_types
:
raise
ValueError
,
u'Invalid value for {}.type: `{}`'
.
format
(
name
,
self
.
type
)
raise
ValueError
(
'Invalid value for {}.type: `{}`'
.
format
(
name
,
self
.
type
)
)
template_path
=
'templates/html/{}_{}.html'
.
format
(
name
.
lower
(),
self
.
type
)
template_path
=
'templates/html/{}_{}.html'
.
format
(
name
.
lower
(),
self
.
type
)
html
=
render_js_template
(
template_path
,
{
html
=
render_js_template
(
template_path
,
{
...
...
mentoring/table.py
View file @
bb742269
...
@@ -98,8 +98,8 @@ class MentoringTableColumnBlock(LightChild):
...
@@ -98,8 +98,8 @@ class MentoringTableColumnBlock(LightChild):
"""
"""
The content of the column
The content of the column
"""
"""
fragment
,
named_children
=
self
.
get_children_fragment
(
context
,
fragment
,
named_children
=
self
.
get_children_fragment
(
view_name
=
'mentoring_table_view'
,
context
,
view_name
=
'mentoring_table_view'
,
not_instance_of
=
MentoringTableColumnHeaderBlock
)
not_instance_of
=
MentoringTableColumnHeaderBlock
)
fragment
.
add_content
(
render_template
(
'templates/html/mentoring-table-column.html'
,
{
fragment
.
add_content
(
render_template
(
'templates/html/mentoring-table-column.html'
,
{
'self'
:
self
,
'self'
:
self
,
...
@@ -111,8 +111,8 @@ class MentoringTableColumnBlock(LightChild):
...
@@ -111,8 +111,8 @@ class MentoringTableColumnBlock(LightChild):
"""
"""
The content of the column's header
The content of the column's header
"""
"""
fragment
,
named_children
=
self
.
get_children_fragment
(
context
,
fragment
,
named_children
=
self
.
get_children_fragment
(
view_name
=
'mentoring_table_header_view'
,
context
,
view_name
=
'mentoring_table_header_view'
,
instance_of
=
MentoringTableColumnHeaderBlock
)
instance_of
=
MentoringTableColumnHeaderBlock
)
fragment
.
add_content
(
render_template
(
'templates/html/mentoring-table-header.html'
,
{
fragment
.
add_content
(
render_template
(
'templates/html/mentoring-table-header.html'
,
{
'self'
:
self
,
'self'
:
self
,
...
@@ -131,4 +131,3 @@ class MentoringTableColumnHeaderBlock(LightChild):
...
@@ -131,4 +131,3 @@ class MentoringTableColumnHeaderBlock(LightChild):
fragment
=
super
(
MentoringTableColumnHeaderBlock
,
self
)
.
children_view
(
context
)
fragment
=
super
(
MentoringTableColumnHeaderBlock
,
self
)
.
children_view
(
context
)
fragment
.
add_content
(
unicode
(
self
.
content
))
fragment
.
add_content
(
unicode
(
self
.
content
))
return
fragment
return
fragment
mentoring/test_base.py
View file @
bb742269
...
@@ -33,6 +33,7 @@ from .utils import load_scenarios_from_path
...
@@ -33,6 +33,7 @@ from .utils import load_scenarios_from_path
# Classes ###########################################################
# Classes ###########################################################
class
MentoringBaseTest
(
SeleniumTest
):
class
MentoringBaseTest
(
SeleniumTest
):
def
setUp
(
self
):
def
setUp
(
self
):
...
@@ -57,7 +58,6 @@ class MentoringBaseTest(SeleniumTest):
...
@@ -57,7 +58,6 @@ class MentoringBaseTest(SeleniumTest):
wait
=
WebDriverWait
(
submit
,
10
)
wait
=
WebDriverWait
(
submit
,
10
)
wait
.
until
(
lambda
s
:
not
s
.
is_enabled
(),
"{} should be disabled"
.
format
(
submit
.
text
))
wait
.
until
(
lambda
s
:
not
s
.
is_enabled
(),
"{} should be disabled"
.
format
(
submit
.
text
))
def
go_to_page
(
self
,
page_name
,
css_selector
=
'div.mentoring'
):
def
go_to_page
(
self
,
page_name
,
css_selector
=
'div.mentoring'
):
"""
"""
Navigate to the page `page_name`, as listed on the workbench home
Navigate to the page `page_name`, as listed on the workbench home
...
@@ -68,4 +68,3 @@ class MentoringBaseTest(SeleniumTest):
...
@@ -68,4 +68,3 @@ class MentoringBaseTest(SeleniumTest):
time
.
sleep
(
1
)
time
.
sleep
(
1
)
mentoring
=
self
.
browser
.
find_element_by_css_selector
(
css_selector
)
mentoring
=
self
.
browser
.
find_element_by_css_selector
(
css_selector
)
return
mentoring
return
mentoring
mentoring/tip.py
View file @
bb742269
...
@@ -45,10 +45,9 @@ def commas_to_set(commas_str):
...
@@ -45,10 +45,9 @@ def commas_to_set(commas_str):
else
:
else
:
return
set
(
commas_str
.
split
(
','
))
return
set
(
commas_str
.
split
(
','
))
# Classes ###########################################################
# Classes ###########################################################
class
TipBlock
(
LightChild
):
class
TipBlock
(
LightChild
):
"""
"""
Each choice can define a tip depending on selection
Each choice can define a tip depending on selection
...
...
mentoring/title.py
View file @
bb742269
...
@@ -33,6 +33,7 @@ log = logging.getLogger(__name__)
...
@@ -33,6 +33,7 @@ log = logging.getLogger(__name__)
# Classes ###########################################################
# Classes ###########################################################
class
TitleBlock
(
LightChild
):
class
TitleBlock
(
LightChild
):
"""
"""
A simple html representation of a title, with the mentoring weight.
A simple html representation of a title, with the mentoring weight.
...
...
tests/integration/test_answer.py
View file @
bb742269
...
@@ -98,4 +98,3 @@ class AnswerBlockTest(MentoringBaseTest):
...
@@ -98,4 +98,3 @@ class AnswerBlockTest(MentoringBaseTest):
# Submit is disabled after submission
# Submit is disabled after submission
self
.
wait_until_disabled
(
submit
)
self
.
wait_until_disabled
(
submit
)
tests/integration/test_progression.py
View file @
bb742269
...
@@ -76,7 +76,9 @@ class MentoringProgressionTest(MentoringBaseTest):
...
@@ -76,7 +76,9 @@ class MentoringProgressionTest(MentoringBaseTest):
messages
=
mentoring
.
find_element_by_css_selector
(
'.messages'
)
messages
=
mentoring
.
find_element_by_css_selector
(
'.messages'
)
self
.
assertTrue
(
messages
.
is_displayed
())
self
.
assertTrue
(
messages
.
is_displayed
())
self
.
assertIn
(
'You need to complete all previous steps before being able to complete the current one.'
,
messages
.
text
)
self
.
assertIn
(
'You need to complete all previous steps before being able to complete the current one.'
,
messages
.
text
)
mentoring
=
self
.
go_to_page
(
'Progression 2'
)
mentoring
=
self
.
go_to_page
(
'Progression 2'
)
warning
=
mentoring
.
find_element_by_css_selector
(
'.warning'
)
warning
=
mentoring
.
find_element_by_css_selector
(
'.warning'
)
...
...
tests/integration/test_table.py
View file @
bb742269
...
@@ -57,4 +57,3 @@ class MentoringTableBlockTest(MentoringBaseTest):
...
@@ -57,4 +57,3 @@ class MentoringTableBlockTest(MentoringBaseTest):
self
.
assertEqual
(
len
(
rows
),
2
)
self
.
assertEqual
(
len
(
rows
),
2
)
self
.
assertEqual
(
rows
[
0
]
.
text
,
'This is the answer #1'
)
self
.
assertEqual
(
rows
[
0
]
.
text
,
'This is the answer #1'
)
self
.
assertEqual
(
rows
[
1
]
.
text
,
'This is the answer #2'
)
self
.
assertEqual
(
rows
[
1
]
.
text
,
'This is the answer #2'
)
tests/unit/test_step.py
View file @
bb742269
...
@@ -6,6 +6,7 @@ from mentoring import MentoringBlock
...
@@ -6,6 +6,7 @@ from mentoring import MentoringBlock
import
mentoring
import
mentoring
from
mentoring.step
import
StepMixin
,
StepParentMixin
from
mentoring.step
import
StepMixin
,
StepParentMixin
class
Parent
(
StepParentMixin
):
class
Parent
(
StepParentMixin
):
def
get_children_objects
(
self
):
def
get_children_objects
(
self
):
return
list
(
self
.
_children
)
return
list
(
self
.
_children
)
...
@@ -18,10 +19,15 @@ class Parent(StepParentMixin):
...
@@ -18,10 +19,15 @@ class Parent(StepParentMixin):
except
AttributeError
:
except
AttributeError
:
pass
pass
class
Step
(
StepMixin
):
class
Step
(
StepMixin
):
def
__init__
(
self
):
pass
def
__init__
(
self
):
pass
class
NotAStep
(
object
):
pass
class
NotAStep
(
object
):
pass
class
TestStepMixin
(
unittest
.
TestCase
):
class
TestStepMixin
(
unittest
.
TestCase
):
def
test_single_step_is_returned_correctly
(
self
):
def
test_single_step_is_returned_correctly
(
self
):
...
@@ -39,7 +45,6 @@ class TestStepMixin(unittest.TestCase):
...
@@ -39,7 +45,6 @@ class TestStepMixin(unittest.TestCase):
self
.
assertSequenceEqual
(
block
.
steps
,
[
step1
,
step2
])
self
.
assertSequenceEqual
(
block
.
steps
,
[
step1
,
step2
])
def
test_proper_number_is_returned_for_step
(
self
):
def
test_proper_number_is_returned_for_step
(
self
):
block
=
Parent
()
block
=
Parent
()
step1
=
Step
()
step1
=
Step
()
...
@@ -73,4 +78,3 @@ class TestStepMixin(unittest.TestCase):
...
@@ -73,4 +78,3 @@ class TestStepMixin(unittest.TestCase):
self
.
assertFalse
(
step1
.
lonely_step
)
self
.
assertFalse
(
step1
.
lonely_step
)
self
.
assertFalse
(
step2
.
lonely_step
)
self
.
assertFalse
(
step2
.
lonely_step
)
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