Example #1
0
 def test_recognize_failure_response(self):
     '''
     Should recognize a failure response.
     '''
     failure_xml = self.response_xml.replace('success', 'failure')
     fake = self.mock_response(failure_xml)
     result = OutcomeResponse.from_post_response(fake)
     self.assertTrue(result.is_failure())
Example #2
0
 def test_recognize_failure_response(self):
     '''
     Should recognize a failure response.
     '''
     failure_xml = self.response_xml.replace('success', 'failure')
     fake = self.mock_response(failure_xml)
     result = OutcomeResponse.from_post_response(fake, failure_xml)
     self.assertTrue(result.is_failure())
Example #3
0
 def test_parse_replace_result_response_xml(self):
     '''
     Should parse replaceResult response XML.
     '''
     fake = self.mock_response(self.response_xml)
     response = OutcomeResponse.from_post_response(fake)
     self.assertTrue(response.is_success())
     self.assertEqual(response.code_major, 'success')
     self.assertEqual(response.severity, 'status')
     self.assertEqual(response.description, '')
     self.assertEqual(response.message_ref_identifier, '123456789')
     self.assertEqual(response.operation, 'replaceResult')
     self.assertEqual(response.score, None)
Example #4
0
 def test_parse_replace_result_response_xml(self):
     '''
     Should parse replaceResult response XML.
     '''
     fake = self.mock_response(self.response_xml)
     response = OutcomeResponse.from_post_response(fake, self.response_xml)
     self.assertTrue(response.is_success())
     self.assertEqual(response.code_major, 'success')
     self.assertEqual(response.severity, 'status')
     self.assertEqual(response.description, '')
     self.assertEqual(response.message_ref_identifier, '123456789')
     self.assertEqual(response.operation, 'replaceResult')
     self.assertEqual(response.score, None)
Example #5
0
    def test_parse_read_result_response_xml(self):
        '''
        Should parse readResult response XML.
        '''
        read_xml = self.response_xml.replace(\
                '<replaceResultResponse/>',\
                '''<readResultResponse>
<result>
<resultScore>
<language>en</language>
<textString>0.91</textString>
</resultScore>
</result>
</readResultResponse>''')
        fake = self.mock_response(read_xml)
        response = OutcomeResponse.from_post_response(fake)
        self.assertTrue(response.is_success())
        self.assertEqual(response.code_major, 'success')
        self.assertEqual(response.severity, 'status')
        self.assertEqual(response.description, '')
        self.assertEqual(response.message_ref_identifier, '123456789')
        self.assertEqual(response.score, '0.91')
Example #6
0
    def test_parse_read_result_response_xml(self):
        '''
        Should parse readResult response XML.
        '''
        read_xml = self.response_xml.replace(\
                '<replaceResultResponse/>',\
                '''<readResultResponse>
<result>
<resultScore>
<language>en</language>
<textString>0.91</textString>
</resultScore>
</result>
</readResultResponse>''')
        fake = self.mock_response(read_xml)
        response = OutcomeResponse.from_post_response(fake, read_xml)
        self.assertTrue(response.is_success())
        self.assertEqual(response.code_major, 'success')
        self.assertEqual(response.severity, 'status')
        self.assertEqual(response.description, '')
        self.assertEqual(response.message_ref_identifier, '123456789')
        self.assertEqual(response.score, '0.91')