Skip to content

Commit eb5dc16

Browse files
committed
fixup! [MIG] edi_endpoint_oca: Migration to V19
1 parent 9b90b47 commit eb5dc16

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

edi_endpoint_oca/tests/common.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ def _setup_edi_endpoint(env, backend, exchange_type, backend_type):
4949
"exec_mode": "code",
5050
"code_snippet": (
5151
"record = endpoint.create_exchange_record()\n"
52-
'result = {"response": Response("Created record: %s" % record.identifier)}'
52+
'result = {"response": Response("'
53+
'Created record: %s" % record.identifier)}'
5354
),
5455
}
5556
)

edi_endpoint_oca/tests/test_edi_endpoint_controller.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,33 @@
44

55
import os
66
import unittest
7-
7+
from .common import CommonEDIEndpoint
88
from odoo.tests.common import HttpCase
99

1010

1111
@unittest.skipIf(os.getenv("SKIP_HTTP_CASE"), "EDIEndpointHttpCase skipped")
12-
class EDIEndpointHttpCase(HttpCase):
12+
class EDIEndpointHttpCase(HttpCase, CommonEDIEndpoint):
1313
@classmethod
1414
def setUpClass(cls):
1515
super().setUpClass()
1616
# force sync for demo records
1717
cls.env["edi.endpoint"].search([])._handle_registry_sync()
1818

19+
def tearDown(self):
20+
# Clear routing cache so each test starts clean
21+
self.env.registry.clear_cache("routing")
22+
super().tearDown()
23+
24+
def _make_request(self, route, headers=None):
25+
headers = dict(headers or {})
26+
return self.url_open(route, headers=headers, timeout=60)
27+
1928
def test_call1(self):
2029
endpoint = "/edi/demo/try"
21-
response = self.url_open(endpoint)
30+
response = self._make_request(endpoint)
2231
self.assertEqual(response.status_code, 401)
2332
# Let's login now
2433
self.authenticate("admin", "admin")
25-
response = self.url_open(endpoint)
34+
response = self._make_request(endpoint)
2635
self.assertEqual(response.status_code, 200)
2736
self.assertIn("Created record:", response.content.decode())

0 commit comments

Comments
 (0)