Beispiel #1
0
    def test_different_api_url(self):
        with requests_mock.mock() as m:
            m.post('http://example.com/api?key=fake_key', text='xlsx output')

            pdf_fo = io.BytesIO(b'pdf content')
            c = Client('fake_key', api_url='http://example.com/api')
            s = c.dump(pdf_fo, 'csv')
            self.assertEqual(b'xlsx output', consume(s))
Beispiel #2
0
    def test_successful_conversion(self):
        with requests_mock.mock() as m:
            m.post('https://pdftables.com/api?key=fake_key',
                   text='xlsx output')

            pdf_fo = io.BytesIO(b'pdf content')
            c = Client('fake_key')
            s = c.dump(pdf_fo, 'csv')
            self.assertEqual(b'xlsx output', consume(s))