odoo-somconnexio-python-client 0.2.0__tar.gz → 0.2.2__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.0 → odoo_somconnexio_python_client-0.2.2}/PKG-INFO +1 -1
- odoo_somconnexio_python_client-0.2.2/odoo_somconnexio_python_client/__init__.py +1 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client/resources/crm_lead.py +27 -0
- odoo_somconnexio_python_client-0.2.2/odoo_somconnexio_python_client/resources/documents.py +14 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client.egg-info/PKG-INFO +1 -1
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client.egg-info/SOURCES.txt +2 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/tests/resources/test_crm_lead.py +34 -1
- odoo_somconnexio_python_client-0.2.2/tests/resources/test_documents.py +22 -0
- odoo_somconnexio_python_client-0.2.0/odoo_somconnexio_python_client/__init__.py +0 -1
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/LICENSE +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/README.md +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client/client.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client/exceptions.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client/helpers.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client/resources/__init__.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client/resources/address.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client/resources/broadband_isp_info.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client/resources/contract.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client/resources/coop_agreement.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client/resources/crm_lead_line.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client/resources/discovery_channel.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client/resources/fiber_contracts.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client/resources/invoice.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client/resources/knowledge.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client/resources/mobile_isp_info.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client/resources/mobile_offer_catalog.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client/resources/multimedia_contract.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client/resources/odoo_paging.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client/resources/one_shot_catalog.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client/resources/partner.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client/resources/product_catalog.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client/resources/project_task.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client/resources/provider.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client/resources/sponsees.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client/resources/subscription_request.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client.egg-info/dependency_links.txt +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client.egg-info/not-zip-safe +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client.egg-info/requires.txt +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/odoo_somconnexio_python_client.egg-info/top_level.txt +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/setup.cfg +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/setup.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/tests/resources/__init__.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/tests/resources/test_address.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/tests/resources/test_contract.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/tests/resources/test_coop_agreement.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/tests/resources/test_discovery_channel.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/tests/resources/test_fiber_contracts.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/tests/resources/test_invoice.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/tests/resources/test_knowledge.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/tests/resources/test_mobile_offer_catalog.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/tests/resources/test_multimedia_contract.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/tests/resources/test_one_shot_catalog.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/tests/resources/test_partner.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/tests/resources/test_product_catalog.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/tests/resources/test_project_task.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/tests/resources/test_providers.py +0 -0
- {odoo_somconnexio_python_client-0.2.0 → odoo_somconnexio_python_client-0.2.2}/tests/resources/test_subscription_request.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.2"
|
|
@@ -37,3 +37,30 @@ class CRMLead:
|
|
|
37
37
|
response_data = Client().post("{}/create".format(cls._url_path), kwargs)
|
|
38
38
|
|
|
39
39
|
return cls(**response_data)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class CRMLeadDocument(CRMLead):
|
|
43
|
+
def __init__(
|
|
44
|
+
self, crm_lead_id, crm_lead_token, document_category, document_id, document_exit
|
|
45
|
+
):
|
|
46
|
+
self.crm_lead_id = crm_lead_id
|
|
47
|
+
self.crm_lead_token = crm_lead_token
|
|
48
|
+
self.document_category = document_category
|
|
49
|
+
self.document_id = document_id
|
|
50
|
+
self.document_exit = document_exit
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def get_required_docs_by_token(cls, crm_lead_token):
|
|
54
|
+
return cls._get_get_required_docs(params={"crm_lead_token": crm_lead_token})
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def get_required_docs_by_id(cls, lead_id):
|
|
58
|
+
return cls._get_get_required_docs(params={"lead_id": lead_id})
|
|
59
|
+
|
|
60
|
+
@classmethod
|
|
61
|
+
def _get_get_required_docs(cls, params={}):
|
|
62
|
+
url_path = "{}/{}".format(cls._url_path, "documents-required")
|
|
63
|
+
response_data = Client().get(url_path, params=params, secondary_domain=True)
|
|
64
|
+
if not response_data:
|
|
65
|
+
return []
|
|
66
|
+
return [cls(**data) for data in response_data]
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from odoo_somconnexio_python_client.client import Client
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Documents:
|
|
5
|
+
_url_path = "/documentation"
|
|
6
|
+
|
|
7
|
+
@classmethod
|
|
8
|
+
def send_docs(cls, crm_lead_id, category, files):
|
|
9
|
+
body = {"crm_lead_id": crm_lead_id, "category": category, "files": files}
|
|
10
|
+
return Client().post(
|
|
11
|
+
cls._url_path,
|
|
12
|
+
body,
|
|
13
|
+
secondary_domain=True,
|
|
14
|
+
)
|
|
@@ -19,6 +19,7 @@ odoo_somconnexio_python_client/resources/coop_agreement.py
|
|
|
19
19
|
odoo_somconnexio_python_client/resources/crm_lead.py
|
|
20
20
|
odoo_somconnexio_python_client/resources/crm_lead_line.py
|
|
21
21
|
odoo_somconnexio_python_client/resources/discovery_channel.py
|
|
22
|
+
odoo_somconnexio_python_client/resources/documents.py
|
|
22
23
|
odoo_somconnexio_python_client/resources/fiber_contracts.py
|
|
23
24
|
odoo_somconnexio_python_client/resources/invoice.py
|
|
24
25
|
odoo_somconnexio_python_client/resources/knowledge.py
|
|
@@ -39,6 +40,7 @@ tests/resources/test_contract.py
|
|
|
39
40
|
tests/resources/test_coop_agreement.py
|
|
40
41
|
tests/resources/test_crm_lead.py
|
|
41
42
|
tests/resources/test_discovery_channel.py
|
|
43
|
+
tests/resources/test_documents.py
|
|
42
44
|
tests/resources/test_fiber_contracts.py
|
|
43
45
|
tests/resources/test_invoice.py
|
|
44
46
|
tests/resources/test_knowledge.py
|
|
@@ -2,10 +2,11 @@ from __future__ import unicode_literals # support both Python2 and 3
|
|
|
2
2
|
|
|
3
3
|
from mock import patch
|
|
4
4
|
|
|
5
|
+
import pytest
|
|
5
6
|
import unittest2 as unittest
|
|
6
7
|
|
|
7
8
|
from ..settings import REQUIRED_ENVVARS
|
|
8
|
-
from odoo_somconnexio_python_client.resources.crm_lead import CRMLead
|
|
9
|
+
from odoo_somconnexio_python_client.resources.crm_lead import CRMLead, CRMLeadDocument
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
@patch("odoo_somconnexio_python_client.resources.crm_lead.Client.post")
|
|
@@ -107,3 +108,35 @@ class CRMLeadTests(unittest.TestCase):
|
|
|
107
108
|
|
|
108
109
|
for key, value in broadband_isp_info_data.items():
|
|
109
110
|
self.assertEqual(getattr(broadband_isp_info, key), value)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
class CRMLeadDocumentTest(unittest.TestCase):
|
|
114
|
+
def setUp(self):
|
|
115
|
+
self.id = 63
|
|
116
|
+
self.token = "JjoHC8jmL7tvNu7Bh2k2Sz1H2o3J1ciwirjGHYz6OlM"
|
|
117
|
+
|
|
118
|
+
@pytest.mark.vcr()
|
|
119
|
+
def test_get_required_docs_by_token(self):
|
|
120
|
+
docs = CRMLeadDocument.get_required_docs_by_token(self.token)
|
|
121
|
+
self._assert_successful_response(docs)
|
|
122
|
+
|
|
123
|
+
@pytest.mark.vcr()
|
|
124
|
+
def test_get_required_docs_by_token_not_found(self):
|
|
125
|
+
docs = CRMLeadDocument.get_required_docs_by_token("token")
|
|
126
|
+
self.assertFalse(len(docs))
|
|
127
|
+
|
|
128
|
+
@pytest.mark.vcr()
|
|
129
|
+
def test_get_required_docs_by_id(self):
|
|
130
|
+
docs = CRMLeadDocument.get_required_docs_by_id(self.id)
|
|
131
|
+
self._assert_successful_response(docs)
|
|
132
|
+
|
|
133
|
+
@pytest.mark.vcr()
|
|
134
|
+
def test_get_required_docs_by_id_not_found(self):
|
|
135
|
+
docs = CRMLeadDocument.get_required_docs_by_id(999999)
|
|
136
|
+
self.assertFalse(len(docs))
|
|
137
|
+
|
|
138
|
+
def _assert_successful_response(self, docs):
|
|
139
|
+
assert docs[0].crm_lead_id == self.id
|
|
140
|
+
assert docs[0].crm_lead_token == self.token
|
|
141
|
+
assert docs[0].document_category == "dni_titular_actual"
|
|
142
|
+
self.assertTrue(docs[0].document_exit)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from mock import patch
|
|
2
|
+
|
|
3
|
+
from odoo_somconnexio_python_client.resources.documents import Documents
|
|
4
|
+
import unittest2 as unittest
|
|
5
|
+
|
|
6
|
+
from ..settings import REQUIRED_ENVVARS
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@patch("odoo_somconnexio_python_client.resources.crm_lead.Client.post")
|
|
10
|
+
@patch.dict("os.environ", REQUIRED_ENVVARS)
|
|
11
|
+
class DocumentsTests(unittest.TestCase):
|
|
12
|
+
def test_send_docs(self, client_post_mock):
|
|
13
|
+
crm_lead_id = 1
|
|
14
|
+
category = "dnianterior"
|
|
15
|
+
files = ["file1", "file2"]
|
|
16
|
+
result = Documents.send_docs(crm_lead_id, category, files)
|
|
17
|
+
assert result == client_post_mock.return_value
|
|
18
|
+
client_post_mock.assert_called_with(
|
|
19
|
+
"/documentation",
|
|
20
|
+
{"crm_lead_id": crm_lead_id, "category": category, "files": files},
|
|
21
|
+
secondary_domain=True,
|
|
22
|
+
)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.2.0"
|
|
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
|