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
36cd10b9
Commit
36cd10b9
authored
Jul 30, 2015
by
Braden MacDonald
Browse files
Options
Browse Files
Download
Plain Diff
Update master with fixes from release
parents
fa859075
859df415
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
4 deletions
+22
-4
problem_builder/mentoring.py
+3
-1
problem_builder/tests/integration/test_progression.py
+4
-3
problem_builder/tests/unit/test_mentoring.py
+15
-0
No files found.
problem_builder/mentoring.py
View file @
36cd10b9
...
@@ -291,7 +291,9 @@ class MentoringBlock(XBlock, StepParentMixin, StudioEditableXBlockMixin, StudioC
...
@@ -291,7 +291,9 @@ class MentoringBlock(XBlock, StepParentMixin, StudioEditableXBlockMixin, StudioC
for
child_id
in
self
.
children
:
for
child_id
in
self
.
children
:
child
=
self
.
runtime
.
get_block
(
child_id
)
child
=
self
.
runtime
.
get_block
(
child_id
)
if
not
isinstance
(
child
,
MentoringMessageBlock
):
if
child
is
None
:
# child should not be None but it can happen due to bugs or permission issues
child_content
+=
u"<p>[{}]</p>"
.
format
(
self
.
_
(
u"Error: Unable to load child component."
))
elif
not
isinstance
(
child
,
MentoringMessageBlock
):
try
:
try
:
if
self
.
is_assessment
and
isinstance
(
child
,
StepMixin
):
if
self
.
is_assessment
and
isinstance
(
child
,
StepMixin
):
child_fragment
=
child
.
render
(
'assessment_step_view'
,
context
)
child_fragment
=
child
.
render
(
'assessment_step_view'
,
context
)
...
...
problem_builder/tests/integration/test_progression.py
View file @
36cd10b9
...
@@ -19,7 +19,6 @@
...
@@ -19,7 +19,6 @@
#
#
# Imports ###########################################################
# Imports ###########################################################
from
.base_test
import
MentoringBaseTest
from
.base_test
import
MentoringBaseTest
...
@@ -34,8 +33,10 @@ class MentoringProgressionTest(MentoringBaseTest):
...
@@ -34,8 +33,10 @@ class MentoringProgressionTest(MentoringBaseTest):
"""
"""
self
.
assertEqual
(
warning_dom
.
text
,
'You need to complete the previous step before attempting this step.'
)
self
.
assertEqual
(
warning_dom
.
text
,
'You need to complete the previous step before attempting this step.'
)
warning_link
=
warning_dom
.
find_element_by_xpath
(
'./*'
)
warning_link
=
warning_dom
.
find_element_by_xpath
(
'./*'
)
link_href
=
'http://localhost:8081{}'
.
format
(
link_href
)
self
.
assertTrue
(
self
.
assertEqual
(
warning_link
.
get_attribute
(
'href'
),
link_href
)
warning_link
.
get_attribute
(
'href'
)
.
endswith
(
link_href
),
"expected link href '{}' to end with '{}'"
.
format
(
warning_link
.
get_attribute
(
'href'
),
link_href
)
)
def
assert_warning_is_hidden
(
self
,
mentoring
):
def
assert_warning_is_hidden
(
self
,
mentoring
):
for
elem
in
mentoring
.
find_elements_by_css_selector
(
'.warning'
):
for
elem
in
mentoring
.
find_elements_by_css_selector
(
'.warning'
):
...
...
problem_builder/tests/unit/test_mentoring.py
View file @
36cd10b9
...
@@ -47,6 +47,21 @@ class TestMentoringBlock(unittest.TestCase):
...
@@ -47,6 +47,21 @@ class TestMentoringBlock(unittest.TestCase):
block
=
MentoringBlock
(
MagicMock
(),
DictFieldData
(
data
),
Mock
())
block
=
MentoringBlock
(
MagicMock
(),
DictFieldData
(
data
),
Mock
())
self
.
assertEqual
(
block
.
get_content_titles
(),
expected
)
self
.
assertEqual
(
block
.
get_content_titles
(),
expected
)
def
test_does_not_crash_when_get_child_is_broken
(
self
):
block
=
MentoringBlock
(
MagicMock
(),
DictFieldData
({
'children'
:
[
'invalid_id'
],
}),
Mock
())
with
patch
.
object
(
block
,
'runtime'
)
as
patched_runtime
:
patched_runtime
.
publish
=
Mock
()
patched_runtime
.
service
()
.
ugettext
=
lambda
str
:
str
patched_runtime
.
get_block
=
lambda
block_id
:
None
patched_runtime
.
load_block_type
=
lambda
block_id
:
Mock
fragment
=
block
.
student_view
(
context
=
{})
self
.
assertIn
(
'Unable to load child component'
,
fragment
.
content
)
@ddt.ddt
@ddt.ddt
class
TestMentoringBlockTheming
(
unittest
.
TestCase
):
class
TestMentoringBlockTheming
(
unittest
.
TestCase
):
...
...
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