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
cfad61f3
Commit
cfad61f3
authored
Sep 16, 2017
by
Eugeny Kolpakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed tests
parent
6c5db884
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
4 deletions
+20
-4
problem_builder/choice.py
+1
-1
problem_builder/tests/unit/test_problem_builder.py
+9
-3
problem_builder/tests/unit/test_step_builder.py
+10
-0
No files found.
problem_builder/choice.py
View file @
cfad61f3
...
@@ -77,7 +77,7 @@ class ChoiceBlock(
...
@@ -77,7 +77,7 @@ class ChoiceBlock(
# display_name_with_default gives out correctness - not adding it here
# display_name_with_default gives out correctness - not adding it here
return
{
return
{
'block_id'
:
unicode
(
self
.
scope_ids
.
usage_id
),
'block_id'
:
unicode
(
self
.
scope_ids
.
usage_id
),
'display_name'
:
self
.
_
(
u"Choice ({content})"
)
.
format
(
content
=
self
.
content
)
'display_name'
:
self
.
_
(
u"Choice ({content})"
)
.
format
(
content
=
self
.
content
)
,
'value'
:
self
.
value
,
'value'
:
self
.
value
,
'content'
:
self
.
content
,
'content'
:
self
.
content
,
}
}
...
...
problem_builder/tests/unit/test_problem_builder.py
View file @
cfad61f3
...
@@ -22,9 +22,13 @@ class TestMRQBlock(BlockWithChildrenTestMixin, unittest.TestCase):
...
@@ -22,9 +22,13 @@ class TestMRQBlock(BlockWithChildrenTestMixin, unittest.TestCase):
"""
"""
block
=
MRQBlock
(
Mock
(),
DictFieldData
({}),
Mock
())
block
=
MRQBlock
(
Mock
(),
DictFieldData
({}),
Mock
())
self
.
assert
List
Equal
(
self
.
assert
Items
Equal
(
block
.
student_view_data
()
.
keys
(),
block
.
student_view_data
()
.
keys
(),
[
'hide_results'
,
'tips'
,
'block_id'
,
'weight'
,
'title'
,
'question'
,
'message'
,
'type'
,
'id'
,
'choices'
])
[
'hide_results'
,
'tips'
,
'block_id'
,
'display_name'
,
'weight'
,
'title'
,
'question'
,
'message'
,
'type'
,
'id'
,
'choices'
]
)
@ddt.ddt
@ddt.ddt
...
@@ -139,7 +143,8 @@ class TestMentoringBlock(BlockWithChildrenTestMixin, unittest.TestCase):
...
@@ -139,7 +143,8 @@ class TestMentoringBlock(BlockWithChildrenTestMixin, unittest.TestCase):
}
}
children
=
get_mock_components
()
children
=
get_mock_components
()
children_by_id
=
{
child
.
block_id
:
child
for
child
in
children
}
children_by_id
=
{
child
.
block_id
:
child
for
child
in
children
}
block_data
=
{
'children'
:
children
}
display_name
=
"I'm problem builder"
block_data
=
{
'display_name'
:
display_name
,
'children'
:
children
}
block_data
.
update
(
shared_data
)
block_data
.
update
(
shared_data
)
block
=
MentoringBlock
(
Mock
(
usage_id
=
1
),
DictFieldData
(
block_data
),
Mock
(
usage_id
=
1
))
block
=
MentoringBlock
(
Mock
(
usage_id
=
1
),
DictFieldData
(
block_data
),
Mock
(
usage_id
=
1
))
block
.
runtime
=
Mock
(
block
.
runtime
=
Mock
(
...
@@ -149,6 +154,7 @@ class TestMentoringBlock(BlockWithChildrenTestMixin, unittest.TestCase):
...
@@ -149,6 +154,7 @@ class TestMentoringBlock(BlockWithChildrenTestMixin, unittest.TestCase):
)
)
expected
=
{
expected
=
{
'block_id'
:
'1'
,
'block_id'
:
'1'
,
'display_name'
:
display_name
,
'components'
:
[
'components'
:
[
'child_a_json'
,
'child_a_json'
,
],
],
...
...
problem_builder/tests/unit/test_step_builder.py
View file @
cfad61f3
...
@@ -14,9 +14,14 @@ class TestMentoringBlock(BlockWithChildrenTestMixin, unittest.TestCase):
...
@@ -14,9 +14,14 @@ class TestMentoringBlock(BlockWithChildrenTestMixin, unittest.TestCase):
def
test_student_view_data
(
self
):
def
test_student_view_data
(
self
):
blocks_by_id
=
{}
blocks_by_id
=
{}
services_mocks
=
{
"i18n"
:
Mock
(
ugettext
=
lambda
string
:
string
)
}
mock_runtime
=
Mock
(
mock_runtime
=
Mock
(
get_block
=
lambda
block_id
:
blocks_by_id
[
block_id
],
get_block
=
lambda
block_id
:
blocks_by_id
[
block_id
],
load_block_type
=
lambda
block
:
block
.
__class__
,
load_block_type
=
lambda
block
:
block
.
__class__
,
service
=
lambda
_
,
service_id
:
services_mocks
.
get
(
service_id
),
id_reader
=
Mock
(
id_reader
=
Mock
(
get_definition_id
=
lambda
block_id
:
block_id
,
get_definition_id
=
lambda
block_id
:
block_id
,
get_block_type
=
lambda
block_id
:
blocks_by_id
[
block_id
],
get_block_type
=
lambda
block_id
:
blocks_by_id
[
block_id
],
...
@@ -90,6 +95,7 @@ class TestMentoringBlock(BlockWithChildrenTestMixin, unittest.TestCase):
...
@@ -90,6 +95,7 @@ class TestMentoringBlock(BlockWithChildrenTestMixin, unittest.TestCase):
expected
=
{
expected
=
{
'block_id'
:
u'1'
,
'block_id'
:
u'1'
,
'display_name'
:
step_builder_data
[
'display_name'
],
'title'
:
step_builder_data
[
'display_name'
],
'title'
:
step_builder_data
[
'display_name'
],
'show_title'
:
step_builder_data
[
'show_title'
],
'show_title'
:
step_builder_data
[
'show_title'
],
'weight'
:
step_builder_data
[
'weight'
],
'weight'
:
step_builder_data
[
'weight'
],
...
@@ -99,6 +105,7 @@ class TestMentoringBlock(BlockWithChildrenTestMixin, unittest.TestCase):
...
@@ -99,6 +105,7 @@ class TestMentoringBlock(BlockWithChildrenTestMixin, unittest.TestCase):
{
{
'block_id'
:
'2'
,
'block_id'
:
'2'
,
'type'
:
'sb-step'
,
'type'
:
'sb-step'
,
'display_name'
:
step_data
[
'display_name'
],
'title'
:
step_data
[
'display_name'
],
'title'
:
step_data
[
'display_name'
],
'show_title'
:
step_data
[
'show_title'
],
'show_title'
:
step_data
[
'show_title'
],
'next_button_label'
:
step_data
[
'next_button_label'
],
'next_button_label'
:
step_data
[
'next_button_label'
],
...
@@ -108,14 +115,17 @@ class TestMentoringBlock(BlockWithChildrenTestMixin, unittest.TestCase):
...
@@ -108,14 +115,17 @@ class TestMentoringBlock(BlockWithChildrenTestMixin, unittest.TestCase):
{
{
'block_id'
:
'3'
,
'block_id'
:
'3'
,
'type'
:
'sb-review-step'
,
'type'
:
'sb-review-step'
,
'display_name'
:
review_step_data
[
'display_name'
],
'title'
:
review_step_data
[
'display_name'
],
'title'
:
review_step_data
[
'display_name'
],
'components'
:
[
'components'
:
[
{
{
'block_id'
:
'4'
,
'block_id'
:
'4'
,
'display_name'
:
"Score Summary"
,
'type'
:
'sb-review-score'
,
'type'
:
'sb-review-score'
,
},
},
{
{
'block_id'
:
'5'
,
'block_id'
:
'5'
,
'display_name'
:
"Conditional Message"
,
'type'
:
'sb-conditional-message'
,
'type'
:
'sb-conditional-message'
,
'content'
:
conditional_message_data
[
'content'
],
'content'
:
conditional_message_data
[
'content'
],
'score_condition'
:
conditional_message_data
[
'score_condition'
],
'score_condition'
:
conditional_message_data
[
'score_condition'
],
...
...
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