Commit da470afc by Usman Khalid

Merge pull request #3187 from edx/adam/fix-alter-xblock-student-state

Adam/fix alter xblock student state
parents b3075e28 aefa456e
......@@ -1745,9 +1745,26 @@ class TestInstructorAPIHelpers(TestCase):
self.assertEqual(_split_input_list(scary_unistuff), [scary_unistuff])
def test_msk_from_problem_urlname(self):
args = ('MITx/6.002x/2013_Spring', 'L2Node1')
output = 'i4x://MITx/6.002x/problem/L2Node1'
self.assertEqual(_msk_from_problem_urlname(*args), output)
course_id = 'RobotU/Robots101/3001_Spring'
capa_urlname = 'capa_urlname'
capa_urlname_xml = 'capa_urlname.xml'
xblock_urlname = 'notaproblem/someothername'
xblock_urlname_xml = 'notaproblem/someothername.xml'
capa_msk = 'i4x://RobotU/Robots101/problem/capa_urlname'
xblock_msk = 'i4x://RobotU/Robots101/notaproblem/someothername'
for urlname in [capa_urlname, capa_urlname_xml]:
self.assertEqual(
_msk_from_problem_urlname(course_id, urlname),
capa_msk
)
for urlname in [xblock_urlname, xblock_urlname_xml]:
self.assertEqual(
_msk_from_problem_urlname(course_id, urlname),
xblock_msk
)
@raises(ValueError)
def test_msk_from_problem_urlname_error(self):
......
......@@ -1252,9 +1252,9 @@ def _msk_from_problem_urlname(course_id, urlname):
urlname = urlname[:-4]
# Combined open ended problems also have state that can be deleted. However,
# appending "problem" will only allow capa problems to be reset.
# Get around this for combinedopenended problems.
if "combinedopenended" not in urlname:
# prepending "problem" will only allow capa problems to be reset.
# Get around this for xblock problems.
if "/" not in urlname:
urlname = "problem/" + urlname
parts = Location.parse_course_id(course_id)
......
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