Fixes for the blockstore API client / XBlock runtime under python 3
This commit is contained in:
@@ -152,7 +152,7 @@ class ContentLibrariesTest(ContentLibrariesRestApiTest):
|
||||
handler_url = self._get_block_handler_url(block_id, "xmodule_handler") + "problem_get"
|
||||
problem_get_response = self.client.get(handler_url)
|
||||
self.assertEqual(problem_get_response.status_code, 200)
|
||||
self.assertIn("You have used 0 of 5 attempts", problem_get_response.content)
|
||||
self.assertIn("You have used 0 of 5 attempts", problem_get_response.content.decode('utf-8'))
|
||||
|
||||
# Now delete the block:
|
||||
self.assertEqual(self._get_library(lib_id)["has_unpublished_deletes"], False)
|
||||
|
||||
@@ -235,7 +235,7 @@ class ContentLibraryXBlockUserStateTest(ContentLibraryContentTestMixin, TestCase
|
||||
|
||||
submit_result = client.post(problem_check_url, data={problem_key: "choice_3"})
|
||||
self.assertEqual(submit_result.status_code, 200)
|
||||
submit_data = json.loads(submit_result.content)
|
||||
submit_data = json.loads(submit_result.content.decode('utf-8'))
|
||||
self.assertDictContainsSubset({
|
||||
"current_score": 0,
|
||||
"total_possible": 1,
|
||||
@@ -251,7 +251,7 @@ class ContentLibraryXBlockUserStateTest(ContentLibraryContentTestMixin, TestCase
|
||||
# And submit a correct answer:
|
||||
submit_result = client.post(problem_check_url, data={problem_key: "choice_1"})
|
||||
self.assertEqual(submit_result.status_code, 200)
|
||||
submit_data = json.loads(submit_result.content)
|
||||
submit_data = json.loads(submit_result.content.decode('utf-8'))
|
||||
self.assertDictContainsSubset({
|
||||
"current_score": 1,
|
||||
"total_possible": 1,
|
||||
|
||||
@@ -46,11 +46,11 @@ def convert_exceptions(fn):
|
||||
log.exception("XBlock not found in content library")
|
||||
raise NotFound
|
||||
except api.LibraryBlockAlreadyExists as exc:
|
||||
log.exception(exc.message)
|
||||
raise ValidationError(exc.message)
|
||||
log.exception(str(exc))
|
||||
raise ValidationError(str(exc))
|
||||
except api.InvalidNameError as exc:
|
||||
log.exception(exc.message)
|
||||
raise ValidationError(exc.message)
|
||||
log.exception(str(exc))
|
||||
raise ValidationError(str(exc))
|
||||
return wrapped_fn
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user