Commit 6aeaeded by muzaffaryousaf

Fixing the failing test.

TNL-900
parent 84a3f27d
...@@ -523,8 +523,6 @@ class TestCourseStaff(XBlockHandlerTestCase): ...@@ -523,8 +523,6 @@ class TestCourseStaff(XBlockHandlerTestCase):
xblock.xmodule_runtime = self._create_mock_runtime( xblock.xmodule_runtime = self._create_mock_runtime(
xblock.scope_ids.usage_id, False, False, "Bob" xblock.scope_ids.usage_id, False, False, "Bob"
) )
xblock.xmodule_runtime.user_is_staff = False
resp = self.request(xblock, 'cancel_submission', json.dumps({})) resp = self.request(xblock, 'cancel_submission', json.dumps({}))
self.assertIn("you do not have permission", resp.decode('utf-8').lower()) self.assertIn("you do not have permission", resp.decode('utf-8').lower())
...@@ -539,9 +537,16 @@ class TestCourseStaff(XBlockHandlerTestCase): ...@@ -539,9 +537,16 @@ class TestCourseStaff(XBlockHandlerTestCase):
def test_cancel_submission_full_flow(self, xblock): def test_cancel_submission_full_flow(self, xblock):
# Simulate that we are course staff # Simulate that we are course staff
xblock.xmodule_runtime = self._create_mock_runtime( xblock.xmodule_runtime = self._create_mock_runtime(
xblock.scope_ids.usage_id, True, False, "Bob" xblock.scope_ids.usage_id, False, False, "Bob"
) )
resp = self.request(xblock, 'cancel_submission', json.dumps({}))
self.assertIn("you do not have permission", resp.decode('utf-8').lower())
# If we ARE course staff, then we should see the cancel submission option
# with valid error message.
xblock.xmodule_runtime.user_is_staff = True
bob_item = STUDENT_ITEM.copy() bob_item = STUDENT_ITEM.copy()
bob_item["item_id"] = xblock.scope_ids.usage_id bob_item["item_id"] = xblock.scope_ids.usage_id
# Create a submission for Bob, and corresponding workflow. # Create a submission for Bob, and corresponding workflow.
......
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