def test_replace_result_score(self): xml = outcomes.generate_replace_result_xml(self.result_id, self.score) tree = etree.fromstring(xml) xml_score = tree.xpath( '/ns:imsx_POXEnvelopeRequest/ns:imsx_POXBody/ns:replaceResultRequest/' 'ns:resultRecord/ns:result/ns:resultScore/ns:textString', namespaces={'ns': 'http://www.imsglobal.org/services/ltiv1p1/xsd/imsoms_v1p0'} ) self.assertEqual(len(xml_score), 1) self.assertEqual(xml_score[0].text, '0.25')
def test_replace_result_sourced_id(self): xml = outcomes.generate_replace_result_xml(self.result_id, self.score) tree = etree.fromstring(xml) sourced_id = tree.xpath( '/ns:imsx_POXEnvelopeRequest/ns:imsx_POXBody/ns:replaceResultRequest/' 'ns:resultRecord/ns:sourcedGUID/ns:sourcedId', namespaces={'ns': 'http://www.imsglobal.org/services/ltiv1p1/xsd/imsoms_v1p0'} ) self.assertEqual(len(sourced_id), 1) self.assertEqual(sourced_id[0].text, 'result_id')
def test_replace_result_message_uuid(self, _uuid_mock): # Pylint doesn't recognize members in the LXML module xml = outcomes.generate_replace_result_xml(self.result_id, self.score) tree = etree.fromstring(xml) message_id = tree.xpath( '//ns:imsx_messageIdentifier', namespaces={'ns': 'http://www.imsglobal.org/services/ltiv1p1/xsd/imsoms_v1p0'} ) self.assertEqual(len(message_id), 1) self.assertEqual(message_id[0].text, 'random_uuid')