Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
RateXBlock
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
edx
RateXBlock
Commits
3d4bbb5d
Commit
3d4bbb5d
authored
Dec 24, 2015
by
Piotr Mitros
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Syncing between machines; may be non-working; starting to test p
parent
685ebd24
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
3 deletions
+25
-3
rate/rate.py
+1
-1
ratetests/test_rate.py
+24
-2
No files found.
rate/rate.py
View file @
3d4bbb5d
...
...
@@ -266,7 +266,7 @@ class RateXBlock(XBlock):
frag
=
Fragment
(
unicode
(
html_str
)
.
format
(
**
prompt
))
js_str
=
self
.
resource_string
(
"static/js/src/studio.js"
)
frag
.
add_javascript
(
unicode
(
js_str
))
frag
.
initialize_js
(
'RateBlock'
)
frag
.
initialize_js
(
'RateBlock'
,
{}
)
return
frag
@XBlock.json_handler
...
...
ratetests/test_rate.py
View file @
3d4bbb5d
...
...
@@ -7,6 +7,26 @@ import json
from
openedx.tests.xblock_integration.xblock_testcase
import
XBlockTestCase
class
PatchRandomMixin
:
"""
This is a class which will patch random.uniform so that we can
confirm whether randomization works.
"""
def
setUp
(
self
):
self
.
value
=
None
def
patched_uniform
(
mock_self
,
min
,
max
):
return
self
.
value
patcher
=
mock
.
patch
(
"random.random.uniform"
,
patched_uniform
)
patcher
.
start
()
self
.
addCleanup
(
patcher
.
stop
)
def
set_random
(
self
,
value
):
self
.
value
=
value
# pylint: disable=abstract-method
class
TestRate
(
XBlockTestCase
):
"""
...
...
@@ -30,11 +50,13 @@ class TestRate(XBlockTestCase):
"xblocks"
:
[
# Stopgap until we handle OLX
{
'blocktype'
:
'rate'
,
'urlname'
:
'rate_0'
'urlname'
:
'rate_0'
,
'parameters'
:
{
'p'
:
100
}
},
{
'blocktype'
:
'rate'
,
'urlname'
:
'rate_1'
'urlname'
:
'rate_1'
,
'parameters'
:
{
'p'
:
50
}
}
]
}
...
...
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