odoo-somconnexio-python-client 0.2.2__tar.gz → 0.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/PKG-INFO +1 -1
- odoo_somconnexio_python_client-0.2.3/odoo_somconnexio_python_client/__init__.py +1 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client/resources/partner.py +25 -1
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client.egg-info/PKG-INFO +1 -1
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/tests/resources/test_partner.py +30 -0
- odoo_somconnexio_python_client-0.2.2/odoo_somconnexio_python_client/__init__.py +0 -1
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/LICENSE +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/README.md +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client/client.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client/exceptions.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client/helpers.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client/resources/__init__.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client/resources/address.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client/resources/broadband_isp_info.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client/resources/contract.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client/resources/coop_agreement.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client/resources/crm_lead.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client/resources/crm_lead_line.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client/resources/discovery_channel.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client/resources/documents.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client/resources/fiber_contracts.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client/resources/invoice.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client/resources/knowledge.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client/resources/mobile_isp_info.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client/resources/mobile_offer_catalog.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client/resources/multimedia_contract.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client/resources/odoo_paging.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client/resources/one_shot_catalog.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client/resources/product_catalog.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client/resources/project_task.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client/resources/provider.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client/resources/sponsees.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client/resources/subscription_request.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client.egg-info/SOURCES.txt +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client.egg-info/dependency_links.txt +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client.egg-info/not-zip-safe +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client.egg-info/requires.txt +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/odoo_somconnexio_python_client.egg-info/top_level.txt +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/setup.cfg +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/setup.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/tests/resources/__init__.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/tests/resources/test_address.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/tests/resources/test_contract.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/tests/resources/test_coop_agreement.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/tests/resources/test_crm_lead.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/tests/resources/test_discovery_channel.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/tests/resources/test_documents.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/tests/resources/test_fiber_contracts.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/tests/resources/test_invoice.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/tests/resources/test_knowledge.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/tests/resources/test_mobile_offer_catalog.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/tests/resources/test_multimedia_contract.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/tests/resources/test_one_shot_catalog.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/tests/resources/test_product_catalog.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/tests/resources/test_project_task.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/tests/resources/test_providers.py +0 -0
- {odoo_somconnexio_python_client-0.2.2 → odoo_somconnexio_python_client-0.2.3}/tests/resources/test_subscription_request.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.3"
|
|
@@ -82,11 +82,12 @@ class Partner:
|
|
|
82
82
|
def check_sponsor(cls, vat, sponsor_code):
|
|
83
83
|
"""
|
|
84
84
|
Check if partner can sponsor new partners.
|
|
85
|
+
Check a sponsorship code against the VAT number
|
|
85
86
|
|
|
86
87
|
:return: True or False
|
|
87
88
|
"""
|
|
88
89
|
if not vat or not sponsor_code:
|
|
89
|
-
return False
|
|
90
|
+
return False, "sponsor_code and vat number are required"
|
|
90
91
|
|
|
91
92
|
url = "{}/{}".format(cls._url_path, "check_sponsor")
|
|
92
93
|
params = {
|
|
@@ -101,6 +102,29 @@ class Partner:
|
|
|
101
102
|
raise ResourceNotFound(resource=cls.__name__, filter=params)
|
|
102
103
|
return response_data["result"] == "allowed", response_data["message"]
|
|
103
104
|
|
|
105
|
+
@classmethod
|
|
106
|
+
def check_sponsor_code(cls, sponsor_code):
|
|
107
|
+
"""
|
|
108
|
+
Check if partner can sponsor new partners.
|
|
109
|
+
Check a sponsorship code
|
|
110
|
+
|
|
111
|
+
:return: True or False
|
|
112
|
+
"""
|
|
113
|
+
if not sponsor_code:
|
|
114
|
+
return False, "sponsor_code is required"
|
|
115
|
+
|
|
116
|
+
url = "{}/{}".format(cls._url_path, "check_sponsor_code")
|
|
117
|
+
params = {
|
|
118
|
+
"sponsor_code": sponsor_code,
|
|
119
|
+
}
|
|
120
|
+
response_data = Client().get(
|
|
121
|
+
url,
|
|
122
|
+
params=params,
|
|
123
|
+
)
|
|
124
|
+
if not response_data:
|
|
125
|
+
raise ResourceNotFound(resource=cls.__name__, filter=params)
|
|
126
|
+
return response_data["result"] == "allowed", response_data["message"]
|
|
127
|
+
|
|
104
128
|
@classmethod
|
|
105
129
|
def sponsees(cls, ref):
|
|
106
130
|
"""
|
|
@@ -35,6 +35,16 @@ class PartnerTests(unittest.TestCase):
|
|
|
35
35
|
assert "new_service" in partner.banned_actions
|
|
36
36
|
self.assertFalse(partner.is_company)
|
|
37
37
|
|
|
38
|
+
def test_check_sponsor_ko_sponsor_code_not_informed(self):
|
|
39
|
+
result, message = Partner.check_sponsor("ES12345678X", "")
|
|
40
|
+
assert not result
|
|
41
|
+
assert message == "sponsor_code and vat number are required"
|
|
42
|
+
|
|
43
|
+
def test_check_sponsor_ko_vat_not_informed(self):
|
|
44
|
+
result, message = Partner.check_sponsor("", "XXXXX")
|
|
45
|
+
assert not result
|
|
46
|
+
assert message == "sponsor_code and vat number are required"
|
|
47
|
+
|
|
38
48
|
@pytest.mark.vcr()
|
|
39
49
|
def test_check_sponsor_ok(self):
|
|
40
50
|
sponsor_code = "cac3c"
|
|
@@ -62,6 +72,26 @@ class PartnerTests(unittest.TestCase):
|
|
|
62
72
|
assert not result
|
|
63
73
|
assert message == "invalid code or vat number"
|
|
64
74
|
|
|
75
|
+
def test_check_sponsor_code_ko_code_not_informed(self):
|
|
76
|
+
sponsor_code = ""
|
|
77
|
+
result, message = Partner.check_sponsor_code(sponsor_code)
|
|
78
|
+
assert not result
|
|
79
|
+
assert message == "sponsor_code is required"
|
|
80
|
+
|
|
81
|
+
@pytest.mark.vcr()
|
|
82
|
+
def test_check_sponsor_code_ko_code_not_found(self):
|
|
83
|
+
sponsor_code = "XXXXX"
|
|
84
|
+
result, message = Partner.check_sponsor_code(sponsor_code)
|
|
85
|
+
assert not result
|
|
86
|
+
assert message == "invalid code"
|
|
87
|
+
|
|
88
|
+
@pytest.mark.vcr()
|
|
89
|
+
def test_check_sponsor_code_ok(self):
|
|
90
|
+
sponsor_code = "KPWMO"
|
|
91
|
+
result, message = Partner.check_sponsor_code(sponsor_code)
|
|
92
|
+
assert result
|
|
93
|
+
assert message == "ok"
|
|
94
|
+
|
|
65
95
|
@pytest.mark.vcr()
|
|
66
96
|
def test_get_sponsees_not_found(self):
|
|
67
97
|
self.assertRaises(ResourceNotFound, Partner.sponsees, ref="NOT_EXISTS")
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.2.2"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|