From d59481f82ce6703c859894b88abfb9f3699649c9 Mon Sep 17 00:00:00 2001 From: Pierre Verkest Date: Tue, 19 Dec 2023 11:01:21 +0100 Subject: [PATCH] [FIX] edi_webservice_oca: HTTPError are Retried As long OSError are part of retryable exceptions and HTTPError inherits from OSSError we are catching the new exception * PR introducing that change: https://github.com/OCA/edi/pull/796 * HTTPError implementation: https://github.com/python/cpython/blob/3.12/Lib/urllib/error.py --- edi_webservice_oca/tests/test_send_saving_response.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/edi_webservice_oca/tests/test_send_saving_response.py b/edi_webservice_oca/tests/test_send_saving_response.py index 680baa822a..9294b30079 100644 --- a/edi_webservice_oca/tests/test_send_saving_response.py +++ b/edi_webservice_oca/tests/test_send_saving_response.py @@ -6,10 +6,11 @@ import responses from odoo_test_helper import FakeModelLoader -from requests import HTTPError from odoo import models +from odoo.addons.queue_job.exception import RetryableJobError + from .common import TestEDIWebserviceBase @@ -80,7 +81,7 @@ def test_component_send_save_results_on_http_error_without_changing_exchange_sta "WebserviceBackend._consumer_record_env", side_effect=self._consumer_record_no_new_env, ) as mo: - with self.assertRaisesRegex(HTTPError, "Unauthorized"): + with self.assertRaisesRegex(RetryableJobError, "Unauthorized"): self.backend._check_output_exchange_sync() mo.assert_called_once_with(self.record, new_cursor=True) self.assertEqual(self.record.edi_exchange_state, "output_pending") @@ -194,7 +195,7 @@ def test_component_send_save_results_on_http_error(self): "WebserviceBackend._consumer_record_env", side_effect=self._consumer_record_no_new_env, ) as mo: - with self.assertRaisesRegex(HTTPError, "Unauthorized"): + with self.assertRaisesRegex(RetryableJobError, "Unauthorized"): self.backend._check_output_exchange_sync() mo.assert_called_once_with(self.record, new_cursor=True) self.assertTrue(self.edi_exchange_state_changed)