-
-
Notifications
You must be signed in to change notification settings - Fork 310
/
test_backend.py
37 lines (32 loc) · 1.32 KB
/
test_backend.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Copyright 2020 Creu Blanca
# @author: Enric Tobella
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.addons.edi_oca.tests.common import EDIBackendCommonTestCase
class TestEdiWebService(EDIBackendCommonTestCase):
@classmethod
def _setup_records(cls):
super()._setup_records()
cls.webservice = cls.env["webservice.backend"].create(
{
"name": "WebService",
"protocol": "http",
"url": "http://localhost.demo.odoo/",
"content_type": "application/xml",
"tech_name": "demo_ws",
"auth_type": "user_pwd",
"username": "user",
"password": "pwd",
}
)
vals = {
"model": cls.partner._name,
"res_id": cls.partner.id,
}
cls.record = cls.backend.create_record("test_csv_input", vals)
def test_components_with_ws(self):
self.backend.webservice_backend_id = self.webservice
components = self.backend._get_component_usage_candidates(self.record, "send")
self.assertIn("webservice.send", components)
def test_components_without_ws(self):
components = self.backend._get_component_usage_candidates(self.record, "send")
self.assertNotIn("webservice.send", components)