Commit 65a5f0c3 by Will Daly

Accept numeric xblock trace values

parent a29c5383
......@@ -242,7 +242,7 @@ class OpenAssessmentBlock(
Useful for logging, debugging, and uniqueification.
"""
return self.scope_ids.usage_id, self.scope_ids.user_id
return unicode(self.scope_ids.usage_id), unicode(self.scope_ids.user_id)
def get_student_item_dict(self):
"""Create a student_item_dict from our surrounding context.
......
......@@ -100,6 +100,14 @@ class TestOpenAssessment(XBlockHandlerTestCase):
student_view = xblock.student_view({})
self.assertIsNotNone(student_view)
@scenario('data/basic_scenario.xml', user_id=2)
def test_numeric_scope_ids(self, xblock):
# Even if we're passed a numeric user ID, we should store it as a string
# because that's what our models expect.
student_item = xblock.get_student_item_dict()
self.assertEqual(student_item['student_id'], '2')
self.assertIsInstance(student_item['item_id'], unicode)
class TestDates(XBlockHandlerTestCase):
......
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