Skip to content

Commit

Permalink
[FIX] edi_webservice_oca: HTTPError are Retried
Browse files Browse the repository at this point in the history
As long OSError are part of retryable exceptions and HTTPError
inherits from OSSError we are catching the new exception

* PR introducing that change: OCA#796
* HTTPError implementation: https://github.com/python/cpython/blob/3.12/Lib/urllib/error.py
  • Loading branch information
petrus-v authored and Matthias BARKAT committed Jun 10, 2024
1 parent 95bc510 commit d59481f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions edi_webservice_oca/tests/test_send_saving_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d59481f

Please sign in to comment.