Commit 3d4bbb5d by Piotr Mitros

Syncing between machines; may be non-working; starting to test p

parent 685ebd24
...@@ -266,7 +266,7 @@ class RateXBlock(XBlock): ...@@ -266,7 +266,7 @@ class RateXBlock(XBlock):
frag = Fragment(unicode(html_str).format(**prompt)) frag = Fragment(unicode(html_str).format(**prompt))
js_str = self.resource_string("static/js/src/studio.js") js_str = self.resource_string("static/js/src/studio.js")
frag.add_javascript(unicode(js_str)) frag.add_javascript(unicode(js_str))
frag.initialize_js('RateBlock') frag.initialize_js('RateBlock', {})
return frag return frag
@XBlock.json_handler @XBlock.json_handler
......
...@@ -7,6 +7,26 @@ import json ...@@ -7,6 +7,26 @@ import json
from openedx.tests.xblock_integration.xblock_testcase import XBlockTestCase 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 # pylint: disable=abstract-method
class TestRate(XBlockTestCase): class TestRate(XBlockTestCase):
""" """
...@@ -30,11 +50,13 @@ class TestRate(XBlockTestCase): ...@@ -30,11 +50,13 @@ class TestRate(XBlockTestCase):
"xblocks": [ # Stopgap until we handle OLX "xblocks": [ # Stopgap until we handle OLX
{ {
'blocktype': 'rate', 'blocktype': 'rate',
'urlname': 'rate_0' 'urlname': 'rate_0',
'parameters': {'p': 100}
}, },
{ {
'blocktype': 'rate', 'blocktype': 'rate',
'urlname': 'rate_1' 'urlname': 'rate_1',
'parameters': {'p': 50}
} }
] ]
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment