Skip to content

Commit

Permalink
fix test request handler mock
Browse files Browse the repository at this point in the history
  • Loading branch information
john-herholz-dt committed Aug 18, 2024
1 parent 6c500fd commit 5754ef4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions webservice/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ def setUpClass(cls):

@classmethod
def _request_handler(cls, s: Session, r: PreparedRequest, /, **kw):
if r.url.startswith("http://localhost.demo.odoo/") or r.url.startswith(
if r.url.startswith("https://localhost.demo.odoo/") or r.url.startswith(
"https://custom.url"
):
return cls._super_send(s, r, **kw)
return cls._super_send(r, **kw)
return super()._request_handler(s, r, **kw)


Expand Down
4 changes: 2 additions & 2 deletions webservice/tests/test_webservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class TestWebService(CommonWebService):
@classmethod
def _setup_records(cls):
res = super()._setup_records()
cls.url = "http://localhost.demo.odoo/"
cls.url = "https://localhost.demo.odoo/"
cls.webservice = cls.env["webservice.backend"].create(
{
"name": "WebService",
Expand Down Expand Up @@ -104,7 +104,7 @@ def test_web_service_get_url_combine(self):
def test_web_service_get_url_combine_full_url(self):
endpoint = "api/test"
responses.add(responses.GET, self.url + endpoint, body="{}")
result = self.webservice.call("get", url="http://localhost.demo.odoo/api/test")
result = self.webservice.call("get", url="https://localhost.demo.odoo/api/test")
self.assertEqual(result, b"{}")
self.assertEqual(len(responses.calls), 1)
self.assertEqual(
Expand Down

0 comments on commit 5754ef4

Please sign in to comment.