Skip to content
Snippets Groups Projects
Commit 49845591 authored by Julien Castiaux's avatar Julien Castiaux
Browse files

[FIX] snailmail_account: Show error msg in log


Partial backport of d930a78f

closes odoo/odoo#43528

Signed-off-by: default avatarJulien Castiaux <Julien00859@users.noreply.github.com>
parent 8630251c
No related branches found
No related tags found
No related merge requests found
......@@ -2,10 +2,13 @@
import requests
import json
import base64
import logging
from odoo.addons.account.tests.account_test_classes import AccountingTestCase
from odoo.tests import tagged
_logger = logging.getLogger(__name__)
@tagged('post_install', '-at_install', '-standard', 'external')
class TestPingenSend(AccountingTestCase):
......@@ -81,16 +84,20 @@ class TestPingenSend(AccountingTestCase):
}
response = requests.post(self.pingen_url, data=self.data, files=files)
try:
response.raise_for_status()
except:
return False
return True
if 400 <= response.status_code <= 599:
msg = "%(code)s %(side)s Error for url: %(url)s\n%(body)s" % {
'code': response.status_code,
'side': r"%s",
'url': response.url,
'body': response.text}
if response.status_code <= 499:
raise requests.HTTPError(msg % "Client")
else:
_logger.warning(msg % "Server")
def test_pingen_send_invoice(self):
self.assertTrue(self.render_and_send('external_layout_standard'))
self.assertTrue(self.render_and_send('external_layout_background'))
self.assertTrue(self.render_and_send('external_layout_boxed'))
self.assertTrue(self.render_and_send('external_layout_clean'))
self.render_and_send('external_layout_standard')
self.render_and_send('external_layout_background')
self.render_and_send('external_layout_boxed')
self.render_and_send('external_layout_clean')
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment