-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] companyweb_payment_info: Migration to 17.0
- Loading branch information
1 parent
fc520ef
commit 6152da8
Showing
4 changed files
with
42 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,16 +2,33 @@ | |
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
import os | ||
|
||
import requests | ||
import werkzeug | ||
from freezegun import freeze_time | ||
from requests import PreparedRequest, Session | ||
from vcr_unittest import VCRMixin | ||
|
||
from odoo.exceptions import UserError | ||
from odoo.tests.common import TransactionCase | ||
|
||
_super_send = requests.Session.send | ||
|
||
|
||
class TestUpload(VCRMixin, TransactionCase): | ||
@classmethod | ||
def _request_handler(cls, s: Session, r: PreparedRequest, /, **kw): | ||
""" | ||
Override to allow requests to the companyweb API | ||
because odoo17 only permit calls to localhost | ||
(see https://github.com/odoo/odoo/blob/17.0/odoo/tests/common.py#L265 ) | ||
""" | ||
url = werkzeug.urls.url_parse(r.url) | ||
if url.host in ("payex.companyweb.be",): | ||
return _super_send(s, r, **kw) | ||
return super()._request_handler(s=s, r=r, **kw) | ||
|
||
def setUp(self, *args, **kwargs): | ||
super(TestUpload, self).setUp(*args, **kwargs) | ||
super().setUp(*args, **kwargs) | ||
self.demo_user = self.env.ref("base.user_demo") | ||
self.env.user.company_id.vat = False | ||
self.demo_user.partner_id.email = "[email protected]" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters