Browse Source

[FIX] report_py3o_fusion_server: requests.post returns bytes not str

pull/258/head
Laurent Mignon (ACSONE) 6 years ago
parent
commit
47770e2b86
  1. 2
      report_py3o_fusion_server/models/py3o_report.py
  2. 2
      report_py3o_fusion_server/tests/test_report_py3o_fusion_server.py

2
report_py3o_fusion_server/models/py3o_report.py

@ -96,7 +96,7 @@ class Py3oReport(models.TransientModel):
) )
chunk_size = 1024 chunk_size = 1024
with open(result_path, 'w+') as fd:
with open(result_path, 'w+b') as fd:
for chunk in r.iter_content(chunk_size): for chunk in r.iter_content(chunk_size):
fd.write(chunk) fd.write(chunk)
end_chrono = datetime.now() end_chrono = datetime.now()

2
report_py3o_fusion_server/tests/test_report_py3o_fusion_server.py

@ -9,7 +9,7 @@ from odoo.addons.report_py3o.tests import test_report_py3o
'requests.post', mock.Mock( 'requests.post', mock.Mock(
return_value=mock.Mock( return_value=mock.Mock(
status_code=200, status_code=200,
iter_content=mock.Mock(return_value=['test_result']),
iter_content=mock.Mock(return_value=[b'test_result']),
) )
) )
) )

Loading…
Cancel
Save