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
8d5a730e
Commit
8d5a730e
authored
Feb 04, 2015
by
E. Kolpakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Automatically send progress event when rendered with display_submit=False + tests
parent
b02b1e4e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
1 deletions
+53
-1
mentoring/mentoring.py
+9
-1
mentoring/tests/integration/test_mentoring.py
+9
-0
mentoring/tests/integration/xml/no_display_submit.xml
+5
-0
mentoring/tests/unit/test_mentoring.py
+30
-0
No files found.
mentoring/mentoring.py
View file @
8d5a730e
...
...
@@ -98,7 +98,12 @@ class MentoringBlock(XBlock, StepParentMixin):
scope
=
Scope
.
content
,
enforce_type
=
True
)
display_submit
=
Boolean
(
help
=
"Allow to submit current block?"
,
default
=
True
,
scope
=
Scope
.
content
)
display_submit
=
Boolean
(
help
=
"Allow submission of the current block?"
,
default
=
True
,
scope
=
Scope
.
content
,
enforce_type
=
True
)
xml_content
=
String
(
help
=
"XML content"
,
default
=
default_xml_content
,
scope
=
Scope
.
content
)
# Settings
...
...
@@ -213,6 +218,9 @@ class MentoringBlock(XBlock, StepParentMixin):
fragment
.
initialize_js
(
'MentoringBlock'
)
if
not
self
.
display_submit
:
self
.
runtime
.
publish
(
self
,
'progress'
,
{})
return
fragment
def
migrate_fields
(
self
):
...
...
mentoring/tests/integration/test_mentoring.py
0 → 100644
View file @
8d5a730e
from
selenium.common.exceptions
import
NoSuchElementException
from
.base_test
import
MentoringBaseTest
class
MentoringTest
(
MentoringBaseTest
):
def
test_display_submit_false_does_not_display_submit
(
self
):
mentoring
=
self
.
go_to_page
(
'No Display Submit'
)
with
self
.
assertRaises
(
NoSuchElementException
):
mentoring
.
find_element_by_css_selector
(
'.submit input.input-main'
)
mentoring/tests/integration/xml/no_display_submit.xml
0 → 100644
View file @
8d5a730e
<vertical_demo>
<mentoring
url_name=
"answer_blank_read_only"
enforce_dependency=
"false"
display_submit=
"false"
>
<answer
name=
"answer_blank"
/>
</mentoring>
</vertical_demo>
mentoring/tests/unit/test_mentoring.py
0 → 100644
View file @
8d5a730e
import
unittest
from
mock
import
MagicMock
,
Mock
,
patch
from
xblock.field_data
import
DictFieldData
from
mentoring
import
MentoringBlock
class
TestMentoringBlock
(
unittest
.
TestCase
):
def
test_sends_progress_event_when_rendered_student_view_with_display_submit_false
(
self
):
block
=
MentoringBlock
(
MagicMock
(),
DictFieldData
({
'display_submit'
:
False
}),
Mock
())
with
patch
.
object
(
block
,
'runtime'
)
as
patched_runtime
:
patched_runtime
.
publish
=
Mock
()
block
.
student_view
(
context
=
{})
patched_runtime
.
publish
.
assert_called_once_with
(
block
,
'progress'
,
{})
def
test_does_not_send_progress_event_when_rendered_student_view_with_display_submit_true
(
self
):
block
=
MentoringBlock
(
MagicMock
(),
DictFieldData
({
'display_submit'
:
True
}),
Mock
())
with
patch
.
object
(
block
,
'runtime'
)
as
patched_runtime
:
patched_runtime
.
publish
=
Mock
()
block
.
student_view
(
context
=
{})
self
.
assertFalse
(
patched_runtime
.
publish
.
called
)
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