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
bfa131b6
Commit
bfa131b6
authored
Jun 29, 2017
by
Douglas Cerna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added test for problem builder student_view_data method
parent
e5e917c2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
problem_builder/tests/unit/test_problem_builder.py
+36
-0
No files found.
problem_builder/tests/unit/test_problem_builder.py
View file @
bfa131b6
...
...
@@ -109,6 +109,42 @@ class TestMentoringBlock(BlockWithChildrenTestMixin, unittest.TestCase):
([
'pb-message'
]
if
block
.
is_assessment
else
[])
# Message type: "on-assessment-review"
)
def
test_student_view_data
(
self
):
def
get_mock_components
():
child_a
=
Mock
(
spec
=
[
'student_view_data'
])
child_a
.
block_id
=
'child_a'
child_a
.
student_view_data
.
return_value
=
'child_a_json'
child_b
=
Mock
(
spec
=
[])
child_b
.
block_id
=
'child_b'
return
[
child_a
,
child_b
]
shared_data
=
{
'max_attempts'
:
3
,
'extended_feedback'
:
True
,
'feedback_label'
:
'Feedback label'
,
}
children
=
get_mock_components
()
children_by_id
=
{
child
.
block_id
:
child
for
child
in
children
}
block_data
=
{
'children'
:
children
}
block_data
.
update
(
shared_data
)
block
=
MentoringBlock
(
Mock
(),
DictFieldData
(
block_data
),
Mock
())
block
.
runtime
=
Mock
()
block
.
runtime
.
get_block
.
side_effect
=
lambda
child
:
children_by_id
[
child
.
block_id
]
expected
=
{
'components'
:
[
'child_a_json'
,
],
'messages'
:
{
message_type
:
MentoringMessageBlock
.
MESSAGE_TYPES
[
message_type
][
'studio_label'
]
for
message_type
in
(
'completed'
,
'incomplete'
,
'max_attempts_reached'
,
)
}
}
expected
.
update
(
shared_data
)
self
.
assertEqual
(
block
.
student_view_data
(),
expected
)
@ddt.ddt
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