Пример #1
0
    def test_missing_data_element(self):
        self.remove_xml_node('./getDataResponse/reportDataRow[@rowNum="1"]/columnData[@colNum="1"]/data')
        self.on_post_return_xml()

        request = PaypalReportDataRequest("RE1234567890")
        with self.assertRaisesRegexp(PaypalMalformedResponseError, 'data'):
            request.execute()
Пример #2
0
    def test_missing_data_response(self):
        self.remove_xml_node('./getDataResponse')
        self.on_post_return_xml()

        request = PaypalReportDataRequest("RE1234567890")
        with self.assertRaisesRegexp(PaypalMalformedResponseError, 'getDataResponse'):
            request.execute()
Пример #3
0
    def test_successful_response(self):
        self.on_post_return_xml()

        request = PaypalReportDataRequest("RE1234567890")
        response = request.execute()

        self.assertEqual(response.response_code, 100)
        self.assertEqual(response.response_message, 'Request has completed successfully')
        self.assertEqual(response.rows, [
            ['ABTCRF9KLMZQ', '2015-08-27 00:14:27', 'Sale'],
            ['ABTMMK7332AR', '2015-08-27 00:59:05', ''],
        ])

        self.parse_request_xml()
        self.assert_request_xml_equals('./getDataRequest', """\
<getDataRequest>
    <reportId>RE1234567890</reportId>
    <pageNum>1</pageNum>
</getDataRequest>
""")