mirror of
https://github.com/OCA/reporting-engine.git
synced 2025-02-16 16:30:38 +02:00
Improve tests
This commit is contained in:
committed by
Elmeri Niemelä
parent
7285c99802
commit
bac8750461
@@ -180,7 +180,7 @@ class Py3oParser(report_sxw):
|
|||||||
# we do nice chunked reading from the network...
|
# we do nice chunked reading from the network...
|
||||||
chunk_size = 1024
|
chunk_size = 1024
|
||||||
with NamedTemporaryFile(
|
with NamedTemporaryFile(
|
||||||
suffix=filetype.human_ext,
|
suffix=filetype,
|
||||||
prefix='py3o-template-'
|
prefix='py3o-template-'
|
||||||
) as fd:
|
) as fd:
|
||||||
for chunk in r.iter_content(chunk_size):
|
for chunk in r.iter_content(chunk_size):
|
||||||
|
|||||||
@@ -25,3 +25,15 @@ class TestReportPy3o(TransactionCase):
|
|||||||
res = report.render_report(
|
res = report.render_report(
|
||||||
self.env.user.ids, report.report_name, {})
|
self.env.user.ids, report.report_name, {})
|
||||||
self.assertTrue(res)
|
self.assertTrue(res)
|
||||||
|
py3o_server = self.env['py3o.server'].create({"url": "http://dummy"})
|
||||||
|
# check the call to the fusion server
|
||||||
|
report.write({"py3o_filetype": "pdf",
|
||||||
|
"py3o_server_id": py3o_server.id})
|
||||||
|
with mock.patch('requests.post') as patched_post:
|
||||||
|
magick_response = mock.MagicMock()
|
||||||
|
magick_response.status_code = 200
|
||||||
|
patched_post.return_value = magick_response
|
||||||
|
magick_response.iter_content.return_value = "test result"
|
||||||
|
res = report.render_report(
|
||||||
|
self.env.user.ids, report.report_name, {})
|
||||||
|
self.assertEqual(('test result', '.pdf'), res)
|
||||||
|
|||||||
Reference in New Issue
Block a user