otrs-somconnexio 0.4.4__py2.py3-none-any.whl → 0.7.3__py2.py3-none-any.whl
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.
- otrs_somconnexio/client.py +110 -42
- otrs_somconnexio/exceptions.py +44 -11
- otrs_somconnexio/otrs_models/abstract_article.py +3 -0
- otrs_somconnexio/otrs_models/adsl_data.py +7 -37
- otrs_somconnexio/otrs_models/adsl_dynamic_fields.py +5 -4
- otrs_somconnexio/otrs_models/adsl_ticket.py +9 -5
- otrs_somconnexio/otrs_models/configurations/changes/__init__.py +0 -0
- otrs_somconnexio/otrs_models/configurations/changes/add_data.py +13 -0
- otrs_somconnexio/otrs_models/configurations/changes/change_email.py +16 -0
- otrs_somconnexio/otrs_models/configurations/changes/change_iban.py +8 -0
- otrs_somconnexio/otrs_models/configurations/changes/change_owner.py +19 -0
- otrs_somconnexio/otrs_models/configurations/changes/change_pack.py +6 -0
- otrs_somconnexio/otrs_models/configurations/changes/change_shared_bond.py +7 -0
- otrs_somconnexio/otrs_models/configurations/changes/change_tariff.py +29 -0
- otrs_somconnexio/otrs_models/configurations/changes/change_tariff_adsl.py +20 -0
- otrs_somconnexio/otrs_models/configurations/changes/change_tariff_fiber.py +11 -0
- otrs_somconnexio/otrs_models/configurations/provision/__init__.py +0 -0
- otrs_somconnexio/otrs_models/configurations/{adsl_ticket.py → provision/adsl_ticket.py} +2 -2
- otrs_somconnexio/otrs_models/configurations/{fiber_ticket.py → provision/fiber_ticket.py} +6 -3
- otrs_somconnexio/otrs_models/configurations/provision/mobile_ticket.py +44 -0
- otrs_somconnexio/otrs_models/configurations/provision/router_4G_ticket.py +8 -0
- otrs_somconnexio/otrs_models/configurations/provision/switchboard_ticket.py +10 -0
- otrs_somconnexio/otrs_models/configurations/querys/__init__.py +0 -0
- otrs_somconnexio/otrs_models/configurations/querys/check_coverage.py +16 -0
- otrs_somconnexio/otrs_models/configurations/querys/we_call_you.py +26 -0
- otrs_somconnexio/otrs_models/coverage/adsl.py +1 -1
- otrs_somconnexio/otrs_models/coverage/asociatel_fiber.py +6 -0
- otrs_somconnexio/otrs_models/coverage/mm_fiber.py +7 -0
- otrs_somconnexio/otrs_models/coverage/orange_fiber.py +5 -0
- otrs_somconnexio/otrs_models/coverage/vdf_fiber.py +8 -0
- otrs_somconnexio/otrs_models/coverage_article.py +20 -4
- otrs_somconnexio/otrs_models/coverage_ticket.py +1 -0
- otrs_somconnexio/otrs_models/customer_data.py +15 -3
- otrs_somconnexio/otrs_models/customer_user.py +3 -9
- otrs_somconnexio/otrs_models/fiber_data.py +17 -33
- otrs_somconnexio/otrs_models/fiber_dynamic_fields.py +58 -4
- otrs_somconnexio/otrs_models/fiber_ticket.py +9 -5
- otrs_somconnexio/otrs_models/internet_data.py +79 -0
- otrs_somconnexio/otrs_models/internet_dynamic_fields.py +65 -26
- otrs_somconnexio/otrs_models/mobile_data.py +49 -5
- otrs_somconnexio/otrs_models/mobile_dynamic_fields.py +50 -8
- otrs_somconnexio/otrs_models/mobile_ticket.py +20 -4
- otrs_somconnexio/otrs_models/process_ticket/internet.py +40 -97
- otrs_somconnexio/otrs_models/process_ticket/mobile.py +63 -43
- otrs_somconnexio/otrs_models/process_ticket/process_ticket.py +74 -0
- otrs_somconnexio/otrs_models/providers.py +4 -3
- otrs_somconnexio/otrs_models/provision_article.py +7 -5
- otrs_somconnexio/otrs_models/provision_dynamic_fields.py +76 -11
- otrs_somconnexio/otrs_models/provision_ticket.py +52 -28
- otrs_somconnexio/otrs_models/responsible_data.py +6 -0
- otrs_somconnexio/otrs_models/router_4G_data.py +8 -0
- otrs_somconnexio/otrs_models/router_4G_dynamic_fields.py +9 -0
- otrs_somconnexio/otrs_models/router_4G_ticket.py +26 -0
- otrs_somconnexio/otrs_models/service.py +41 -12
- otrs_somconnexio/otrs_models/switchboard_data.py +58 -0
- otrs_somconnexio/otrs_models/switchboard_dynamic_fields.py +94 -0
- otrs_somconnexio/otrs_models/switchboard_header_data.py +18 -0
- otrs_somconnexio/otrs_models/switchboard_header_dynamic_fields.py +80 -0
- otrs_somconnexio/otrs_models/switchboard_header_ticket.py +30 -0
- otrs_somconnexio/otrs_models/switchboard_ticket.py +35 -0
- otrs_somconnexio/otrs_models/telecom_company.py +69 -69
- otrs_somconnexio/otrs_models/ticket_factory.py +34 -11
- otrs_somconnexio/otrs_models/ticket_types/__init__.py +0 -0
- otrs_somconnexio/otrs_models/ticket_types/add_data_ticket.py +36 -0
- otrs_somconnexio/otrs_models/ticket_types/base_change_tariff_ba_ticket.py +23 -0
- otrs_somconnexio/otrs_models/ticket_types/base_change_ticket.py +33 -0
- otrs_somconnexio/otrs_models/ticket_types/base_customer_ticket.py +24 -0
- otrs_somconnexio/otrs_models/ticket_types/base_ticket.py +147 -0
- otrs_somconnexio/otrs_models/ticket_types/change_email_ticket.py +40 -0
- otrs_somconnexio/otrs_models/ticket_types/change_iban_ticket.py +39 -0
- otrs_somconnexio/otrs_models/ticket_types/change_owner_ticket.py +132 -0
- otrs_somconnexio/otrs_models/ticket_types/change_pack_not_shared_data.py +36 -0
- otrs_somconnexio/otrs_models/ticket_types/change_personal_email_ticket.py +31 -0
- otrs_somconnexio/otrs_models/ticket_types/change_shared_bond_ticket.py +35 -0
- otrs_somconnexio/otrs_models/ticket_types/change_tariff_adsl_landline_ticket.py +30 -0
- otrs_somconnexio/otrs_models/ticket_types/change_tariff_adsl_out_landline_ticket.py +30 -0
- otrs_somconnexio/otrs_models/ticket_types/change_tariff_adsl_ticket.py +42 -0
- otrs_somconnexio/otrs_models/ticket_types/change_tariff_fiber_ticket.py +43 -0
- otrs_somconnexio/otrs_models/ticket_types/change_tariff_ticket.py +87 -0
- otrs_somconnexio/otrs_models/ticket_types/change_tariff_ticket_mobile_pack.py +51 -0
- otrs_somconnexio/otrs_models/ticket_types/change_tariff_ticket_shared_bonds.py +22 -0
- otrs_somconnexio/otrs_models/ticket_types/check_coverage_ticket.py +52 -0
- otrs_somconnexio/otrs_models/ticket_types/we_call_you_ticket.py +53 -0
- otrs_somconnexio/otrs_models/vf_provisioning_article.py +4 -2
- otrs_somconnexio/responses/ticket_creation.py +5 -4
- otrs_somconnexio/services/activate_change_tarriff_mobile_tickets.py +13 -0
- otrs_somconnexio/services/base_get_ticket_by_number.py +22 -0
- otrs_somconnexio/services/change_to_confirm_ticket.py +45 -0
- otrs_somconnexio/services/get_mobile_related_tickets.py +11 -0
- otrs_somconnexio/services/get_sharing_data_mobile_tickets.py +65 -0
- otrs_somconnexio/services/get_ticket_title.py +26 -0
- otrs_somconnexio/services/mapping_mobile_minutes.py +5 -5
- otrs_somconnexio/services/mapping_services.py +8 -6
- otrs_somconnexio/services/move_sharing_data_mobile_tickets.py +13 -0
- otrs_somconnexio/services/search_tickets_mobile_change_tariff.py +25 -0
- otrs_somconnexio/services/search_tickets_service.py +57 -0
- otrs_somconnexio/services/set_SIM_recieved_mobile_ticket.py +107 -0
- otrs_somconnexio/services/set_SIM_returned_mobile_ticket.py +37 -0
- otrs_somconnexio/services/set_fiber_contract_code_mobile_ticket.py +21 -0
- otrs_somconnexio/services/unblock_mobile_pack_ticket.py +48 -0
- otrs_somconnexio/services/update_process_ticket_with_coverage_tickets_info_service.py +10 -10
- otrs_somconnexio/services/update_ticket_DF.py +18 -0
- otrs_somconnexio/services/update_ticket_with_provider_info.py +2 -3
- otrs_somconnexio/user_management_client/client.py +15 -27
- otrs_somconnexio/user_management_client/user_management_response.py +2 -3
- {otrs_somconnexio-0.4.4.dist-info → otrs_somconnexio-0.7.3.dist-info}/METADATA +19 -4
- otrs_somconnexio-0.7.3.dist-info/RECORD +202 -0
- {otrs_somconnexio-0.4.4.dist-info → otrs_somconnexio-0.7.3.dist-info}/WHEEL +1 -1
- tests/data/otrs_raw_responses.py +12 -6
- tests/integration/test_change_customer_language.py +14 -19
- tests/integration/test_ticket_factory.py +383 -106
- tests/integration/test_update_ticket_with_coverage_data.py +53 -27
- tests/otrs_models/common_helper.py +9 -0
- tests/otrs_models/configuration/changes/__init__.py +0 -0
- tests/otrs_models/configuration/changes/test_change_tariff_ticket.py +91 -0
- tests/otrs_models/configuration/provision/__init__.py +0 -0
- tests/otrs_models/configuration/provision/test_adsl_ticket.py +30 -0
- tests/otrs_models/configuration/provision/test_fiber_ticket.py +32 -0
- tests/otrs_models/configuration/provision/test_mobile_ticket.py +62 -0
- tests/otrs_models/process_ticket/test_internet_process_ticket.py +54 -60
- tests/otrs_models/process_ticket/test_mobile_process_ticket.py +56 -33
- tests/otrs_models/test_abstract_article.py +3 -2
- tests/otrs_models/test_adsl_data.py +11 -4
- tests/otrs_models/test_adsl_dynamic_fields.py +217 -100
- tests/otrs_models/test_adsl_ticket.py +78 -83
- tests/otrs_models/test_coverage_article.py +9 -7
- tests/otrs_models/test_coverage_ticket.py +4 -2
- tests/otrs_models/test_customer_user.py +23 -20
- tests/otrs_models/test_fiber_data.py +20 -4
- tests/otrs_models/test_fiber_dynamic_fields.py +458 -134
- tests/otrs_models/test_fiber_ticket.py +113 -79
- tests/otrs_models/test_mobile_data.py +14 -3
- tests/otrs_models/test_mobile_dynamic_fields.py +335 -74
- tests/otrs_models/test_mobile_paused_ticket.py +35 -0
- tests/otrs_models/test_mobile_ticket.py +82 -96
- tests/otrs_models/test_provision_article.py +49 -0
- tests/otrs_models/test_router_4G_data.py +43 -0
- tests/otrs_models/test_router_4G_dynamic_fields.py +619 -0
- tests/otrs_models/test_router_4G_ticket.py +135 -0
- tests/otrs_models/test_service.py +58 -14
- tests/otrs_models/test_switchboard_data.py +37 -0
- tests/otrs_models/test_switchboard_dynamic_fields.py +197 -0
- tests/otrs_models/test_switchboard_header_data.py +18 -0
- tests/otrs_models/test_switchboard_header_dynamic_fields.py +119 -0
- tests/otrs_models/test_switchboard_header_ticket.py +127 -0
- tests/otrs_models/test_switchboard_ticket.py +147 -0
- tests/otrs_models/test_telecom_company.py +16 -16
- tests/otrs_models/test_ticket_factory.py +73 -16
- tests/otrs_models/test_vf_provisioning_article.py +6 -5
- tests/otrs_models/ticket_types/__init__.py +0 -0
- tests/otrs_models/ticket_types/test_add_data.py +79 -0
- tests/otrs_models/ticket_types/test_change_email.py +163 -0
- tests/otrs_models/ticket_types/test_change_iban.py +82 -0
- tests/otrs_models/ticket_types/test_change_owner.py +277 -0
- tests/otrs_models/ticket_types/test_change_pack_not_shared_data.py +77 -0
- tests/otrs_models/ticket_types/test_change_personal_email.py +81 -0
- tests/otrs_models/ticket_types/test_change_tariff.py +435 -0
- tests/otrs_models/ticket_types/test_change_tariff_adsl_landline.py +115 -0
- tests/otrs_models/ticket_types/test_change_tariff_adsl_out_landline.py +115 -0
- tests/otrs_models/ticket_types/test_change_tariff_fiber.py +175 -0
- tests/otrs_models/ticket_types/test_change_tariff_mobile_pack.py +151 -0
- tests/otrs_models/ticket_types/test_change_tariff_shared_bonds.py +65 -0
- tests/otrs_models/ticket_types/test_check_coverage.py +106 -0
- tests/otrs_models/ticket_types/test_shared_bond.py +80 -0
- tests/otrs_models/ticket_types/test_we_call_you.py +108 -0
- tests/responses/test_ticket_creation.py +4 -4
- tests/services/test_activate_change_tariff_mobile_tickets.py +45 -0
- tests/services/test_change_to_confirm_ticket.py +80 -0
- tests/services/test_get_mobile_related_tickets.py +39 -0
- tests/services/test_get_sharing_data_mobile_tickets.py +127 -0
- tests/services/test_mapping_mobile_minutes.py +8 -8
- tests/services/{test_mappint_services.py → test_mapping_services.py} +9 -9
- tests/services/test_move_sharing_data_mobile_tickets.py +43 -0
- tests/services/test_search_tickets_mobile_change_tariff.py +84 -0
- tests/services/test_search_tickets_service.py +166 -0
- tests/services/test_set_SIM_recieved_mobile_ticket_service.py +211 -0
- tests/services/test_set_SIM_returned_mobile_ticket_service.py +59 -0
- tests/services/test_set_fiber_contract_code_mobile_ticket_service.py +47 -0
- tests/services/test_unblock_mobile_pack_ticket.py +224 -0
- tests/services/test_update_process_ticket_with_VF_provisioning.py +15 -14
- tests/services/test_update_process_ticket_with_coverage_tickets_info_service.py +22 -10
- tests/services/test_update_ticket_with_provider_info.py +16 -15
- tests/user_management_client/test_client.py +41 -58
- tests/user_management_client/test_user_management_response.py +13 -26
- otrs_somconnexio/otrs_models/configurations/mobile_ticket.py +0 -17
- otrs_somconnexio/otrs_models/coverage/mm_fibre.py +0 -7
- otrs_somconnexio/otrs_models/coverage/vdf_fibre.py +0 -8
- otrs_somconnexio-0.4.4.dist-info/RECORD +0 -95
- tests/otrs_models/configuration/test_adsl_ticket.py +0 -45
- tests/otrs_models/configuration/test_fiber_ticket.py +0 -45
- tests/otrs_models/configuration/test_mobile_ticket.py +0 -45
- {otrs_somconnexio-0.4.4.dist-info → otrs_somconnexio-0.7.3.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
import unittest
|
|
3
|
+
from mock import Mock, patch
|
|
4
|
+
|
|
5
|
+
from otrs_somconnexio.otrs_models.switchboard_header_ticket import (
|
|
6
|
+
SwitchboardHeaderTicket,
|
|
7
|
+
)
|
|
8
|
+
from otrs_somconnexio.otrs_models.configurations.provision.switchboard_ticket import (
|
|
9
|
+
SwitchboardTicketConfiguration,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class SwitchboardHeaderTicketTestCase(unittest.TestCase):
|
|
14
|
+
def setUp(self):
|
|
15
|
+
self.responsible_data = Mock(spec=["email"])
|
|
16
|
+
|
|
17
|
+
@patch("otrs_somconnexio.otrs_models.provision_ticket.Ticket")
|
|
18
|
+
def test_build_ticket(self, MockTicket):
|
|
19
|
+
service_data = Mock(spec=["order_id", "notes", "technology"])
|
|
20
|
+
service_data.order_id = 123
|
|
21
|
+
customer_data = Mock(spec=["id"])
|
|
22
|
+
|
|
23
|
+
expected_ticket_arguments = {
|
|
24
|
+
"Title": "Provisió centraleta virtual (CV) → Capçalera",
|
|
25
|
+
"Type": SwitchboardTicketConfiguration.type,
|
|
26
|
+
"QueueID": SwitchboardTicketConfiguration.queue_id,
|
|
27
|
+
"State": SwitchboardTicketConfiguration.state,
|
|
28
|
+
"SLA": "No pendent resposta",
|
|
29
|
+
"Service": "Centraleta Virtual",
|
|
30
|
+
"Priority": SwitchboardTicketConfiguration.priority,
|
|
31
|
+
"CustomerUser": customer_data.id,
|
|
32
|
+
"CustomerID": customer_data.id,
|
|
33
|
+
"Responsible": self.responsible_data.email,
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
SwitchboardHeaderTicket(
|
|
37
|
+
service_data, customer_data, self.responsible_data
|
|
38
|
+
)._build_ticket()
|
|
39
|
+
MockTicket.assert_called_with(expected_ticket_arguments)
|
|
40
|
+
|
|
41
|
+
@patch("otrs_somconnexio.otrs_models.provision_ticket.ProvisionArticle")
|
|
42
|
+
def test_build_article(self, MockProvisionArticle):
|
|
43
|
+
service_data = Mock(spec=["order_id", "technology"])
|
|
44
|
+
service_data.order_id = 123
|
|
45
|
+
customer_data = Mock(spec=["order_id"])
|
|
46
|
+
|
|
47
|
+
mock_article = MockProvisionArticle.return_value
|
|
48
|
+
|
|
49
|
+
SwitchboardHeaderTicket(
|
|
50
|
+
service_data, customer_data, self.responsible_data
|
|
51
|
+
)._build_article()
|
|
52
|
+
|
|
53
|
+
MockProvisionArticle.assert_called_with(
|
|
54
|
+
service_data.technology,
|
|
55
|
+
service_data.order_id,
|
|
56
|
+
"switchboard_header",
|
|
57
|
+
)
|
|
58
|
+
mock_article.call.assert_called_once()
|
|
59
|
+
|
|
60
|
+
@patch(
|
|
61
|
+
"otrs_somconnexio.otrs_models.switchboard_header_ticket.SwitchboardHeaderDynamicFields"
|
|
62
|
+
)
|
|
63
|
+
def test_build_dynamic_fields(self, MockSwitchboardHeaderDynamicFields):
|
|
64
|
+
service_data = Mock()
|
|
65
|
+
customer_data = Mock()
|
|
66
|
+
mock_dyn_fields = MockSwitchboardHeaderDynamicFields.return_value
|
|
67
|
+
|
|
68
|
+
SwitchboardHeaderTicket(
|
|
69
|
+
service_data, customer_data, self.responsible_data
|
|
70
|
+
)._build_dynamic_fields()
|
|
71
|
+
MockSwitchboardHeaderDynamicFields.assert_called_with(
|
|
72
|
+
service_data,
|
|
73
|
+
customer_data,
|
|
74
|
+
SwitchboardTicketConfiguration.process_id,
|
|
75
|
+
SwitchboardTicketConfiguration.activity_id,
|
|
76
|
+
)
|
|
77
|
+
mock_dyn_fields.all.assert_called_once()
|
|
78
|
+
|
|
79
|
+
@patch("otrs_somconnexio.otrs_models.provision_ticket.OTRSClient")
|
|
80
|
+
def test_create(self, MockOTRSClient):
|
|
81
|
+
service_data = Mock(
|
|
82
|
+
spec=[
|
|
83
|
+
"order_id",
|
|
84
|
+
"iban",
|
|
85
|
+
"email",
|
|
86
|
+
"contact_phone",
|
|
87
|
+
"product",
|
|
88
|
+
"technology",
|
|
89
|
+
"previous_owner_vat",
|
|
90
|
+
"previous_owner_name",
|
|
91
|
+
"previous_owner_surname",
|
|
92
|
+
"sales_team",
|
|
93
|
+
"type",
|
|
94
|
+
"notes",
|
|
95
|
+
]
|
|
96
|
+
)
|
|
97
|
+
customer_data = Mock(
|
|
98
|
+
spec=[
|
|
99
|
+
"id",
|
|
100
|
+
"first_name",
|
|
101
|
+
"name",
|
|
102
|
+
"vat_number",
|
|
103
|
+
"street",
|
|
104
|
+
"city",
|
|
105
|
+
"zip",
|
|
106
|
+
"subdivision",
|
|
107
|
+
"has_active_contracts",
|
|
108
|
+
"language",
|
|
109
|
+
]
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
mock_otrs_client = Mock(spec=["create_otrs_process_ticket"])
|
|
113
|
+
mock_otrs_client.create_otrs_process_ticket.return_value = Mock(
|
|
114
|
+
SwitchboardHeaderTicket, autospec=True
|
|
115
|
+
)
|
|
116
|
+
mock_otrs_client.create_otrs_process_ticket.return_value.id = 123
|
|
117
|
+
mock_otrs_client.create_otrs_process_ticket.return_value.number = "#123"
|
|
118
|
+
MockOTRSClient.return_value = mock_otrs_client
|
|
119
|
+
|
|
120
|
+
ticket = SwitchboardHeaderTicket(
|
|
121
|
+
service_data, customer_data, self.responsible_data
|
|
122
|
+
)
|
|
123
|
+
ticket.create()
|
|
124
|
+
|
|
125
|
+
mock_otrs_client.create_otrs_process_ticket.assert_called_once()
|
|
126
|
+
self.assertEqual(ticket.id, 123)
|
|
127
|
+
self.assertEqual(ticket.number, "#123")
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
import unittest
|
|
3
|
+
from mock import Mock, patch
|
|
4
|
+
|
|
5
|
+
from otrs_somconnexio.otrs_models.switchboard_ticket import SwitchboardTicket
|
|
6
|
+
from otrs_somconnexio.otrs_models.configurations.provision.switchboard_ticket import (
|
|
7
|
+
SwitchboardTicketConfiguration,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class SwitchboardTicketTestCase(unittest.TestCase):
|
|
12
|
+
def setUp(self):
|
|
13
|
+
self.responsible_data = Mock(spec=["email"])
|
|
14
|
+
self.service_data = Mock(
|
|
15
|
+
spec=["order_id", "technology", "landline", "mobile_phone_number"]
|
|
16
|
+
)
|
|
17
|
+
self.service_data.order_id = 123
|
|
18
|
+
self.customer_data = Mock(spec=["id"])
|
|
19
|
+
|
|
20
|
+
@patch("otrs_somconnexio.otrs_models.provision_ticket.Ticket")
|
|
21
|
+
def test_build_ticket(self, MockTicket):
|
|
22
|
+
self.service_data.landline = False
|
|
23
|
+
self.service_data.mobile_phone_number = False
|
|
24
|
+
|
|
25
|
+
expected_ticket_arguments = {
|
|
26
|
+
"Title": "Provisió centraleta virtual (CV)",
|
|
27
|
+
"Type": SwitchboardTicketConfiguration.type,
|
|
28
|
+
"QueueID": SwitchboardTicketConfiguration.queue_id,
|
|
29
|
+
"State": SwitchboardTicketConfiguration.state,
|
|
30
|
+
"SLA": "No pendent resposta",
|
|
31
|
+
"Service": "Centraleta Virtual",
|
|
32
|
+
"Priority": SwitchboardTicketConfiguration.priority,
|
|
33
|
+
"CustomerUser": self.customer_data.id,
|
|
34
|
+
"CustomerID": self.customer_data.id,
|
|
35
|
+
"Responsible": self.responsible_data.email,
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
SwitchboardTicket(
|
|
39
|
+
self.service_data, self.customer_data, self.responsible_data
|
|
40
|
+
)._build_ticket()
|
|
41
|
+
MockTicket.assert_called_with(expected_ticket_arguments)
|
|
42
|
+
|
|
43
|
+
def test_title_with_landline(self):
|
|
44
|
+
self.service_data.landline = "999999999"
|
|
45
|
+
ticket = SwitchboardTicket(
|
|
46
|
+
self.service_data, self.customer_data, self.responsible_data
|
|
47
|
+
)
|
|
48
|
+
self.assertEqual(ticket._ticket_title(), "Alta número de fix (CV)")
|
|
49
|
+
|
|
50
|
+
def test_title_with_mobile_phone_number(self):
|
|
51
|
+
self.service_data.landline = None
|
|
52
|
+
self.service_data.mobile_phone_number = "699999999"
|
|
53
|
+
ticket = SwitchboardTicket(
|
|
54
|
+
self.service_data, self.customer_data, self.responsible_data
|
|
55
|
+
)
|
|
56
|
+
self.assertEqual(ticket._ticket_title(), "Alta mòbil agent (CV)")
|
|
57
|
+
|
|
58
|
+
@patch("otrs_somconnexio.otrs_models.provision_ticket.ProvisionArticle")
|
|
59
|
+
def test_build_article(self, MockProvisionArticle):
|
|
60
|
+
mock_article = MockProvisionArticle.return_value
|
|
61
|
+
|
|
62
|
+
SwitchboardTicket(
|
|
63
|
+
self.service_data, self.customer_data, self.responsible_data
|
|
64
|
+
)._build_article()
|
|
65
|
+
MockProvisionArticle.assert_called_with(
|
|
66
|
+
self.service_data.technology,
|
|
67
|
+
self.service_data.order_id,
|
|
68
|
+
"switchboard",
|
|
69
|
+
)
|
|
70
|
+
mock_article.call.assert_called_once()
|
|
71
|
+
|
|
72
|
+
@patch("otrs_somconnexio.otrs_models.switchboard_ticket.SwitchboardDynamicFields")
|
|
73
|
+
def test_build_dynamic_fields(self, MockSwitchboardDynamicFields):
|
|
74
|
+
mock_dyn_fields = MockSwitchboardDynamicFields.return_value
|
|
75
|
+
|
|
76
|
+
SwitchboardTicket(
|
|
77
|
+
self.service_data, self.customer_data, self.responsible_data
|
|
78
|
+
)._build_dynamic_fields()
|
|
79
|
+
MockSwitchboardDynamicFields.assert_called_with(
|
|
80
|
+
self.service_data,
|
|
81
|
+
self.customer_data,
|
|
82
|
+
SwitchboardTicketConfiguration.process_id,
|
|
83
|
+
SwitchboardTicketConfiguration.activity_id,
|
|
84
|
+
)
|
|
85
|
+
mock_dyn_fields.all.assert_called_once()
|
|
86
|
+
|
|
87
|
+
@patch("otrs_somconnexio.otrs_models.provision_ticket.OTRSClient")
|
|
88
|
+
def test_create(self, MockOTRSClient):
|
|
89
|
+
service_data = Mock(
|
|
90
|
+
spec=[
|
|
91
|
+
"order_id",
|
|
92
|
+
"iban",
|
|
93
|
+
"email",
|
|
94
|
+
"contact_phone",
|
|
95
|
+
"product",
|
|
96
|
+
"technology",
|
|
97
|
+
"sales_team",
|
|
98
|
+
"type",
|
|
99
|
+
"landline",
|
|
100
|
+
"mobile_phone_number",
|
|
101
|
+
"icc",
|
|
102
|
+
"has_sim",
|
|
103
|
+
"extension",
|
|
104
|
+
"agent_name",
|
|
105
|
+
"agent_email",
|
|
106
|
+
"previous_owner_vat",
|
|
107
|
+
"previous_owner_name",
|
|
108
|
+
"previous_owner_surname",
|
|
109
|
+
"shipment_address",
|
|
110
|
+
"shipment_city",
|
|
111
|
+
"shipment_zip",
|
|
112
|
+
"shipment_subdivision",
|
|
113
|
+
"additional_products",
|
|
114
|
+
"activation_notes",
|
|
115
|
+
"notes",
|
|
116
|
+
"confirmed_documentation",
|
|
117
|
+
]
|
|
118
|
+
)
|
|
119
|
+
customer_data = Mock(
|
|
120
|
+
spec=[
|
|
121
|
+
"id",
|
|
122
|
+
"first_name",
|
|
123
|
+
"name",
|
|
124
|
+
"vat_number",
|
|
125
|
+
"street",
|
|
126
|
+
"city",
|
|
127
|
+
"zip",
|
|
128
|
+
"subdivision",
|
|
129
|
+
"has_active_contracts",
|
|
130
|
+
"language",
|
|
131
|
+
]
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
mock_otrs_client = Mock(spec=["create_otrs_process_ticket"])
|
|
135
|
+
mock_otrs_client.create_otrs_process_ticket.return_value = Mock(
|
|
136
|
+
SwitchboardTicket, autospec=True
|
|
137
|
+
)
|
|
138
|
+
mock_otrs_client.create_otrs_process_ticket.return_value.id = 123
|
|
139
|
+
mock_otrs_client.create_otrs_process_ticket.return_value.number = "#123"
|
|
140
|
+
MockOTRSClient.return_value = mock_otrs_client
|
|
141
|
+
|
|
142
|
+
ticket = SwitchboardTicket(service_data, customer_data, self.responsible_data)
|
|
143
|
+
ticket.create()
|
|
144
|
+
|
|
145
|
+
mock_otrs_client.create_otrs_process_ticket.assert_called_once()
|
|
146
|
+
self.assertEqual(ticket.id, 123)
|
|
147
|
+
self.assertEqual(ticket.number, "#123")
|
|
@@ -12,41 +12,41 @@ class TelecomCompanyTestCase(unittest.TestCase):
|
|
|
12
12
|
def test_mobile_telecom_company_none(self):
|
|
13
13
|
tryton_telecom = None
|
|
14
14
|
|
|
15
|
-
telecom = TelecomCompany(
|
|
15
|
+
telecom = TelecomCompany("mobile", tryton_telecom)
|
|
16
16
|
|
|
17
|
-
self.assertEqual(str(telecom),
|
|
17
|
+
self.assertEqual(str(telecom), "None")
|
|
18
18
|
|
|
19
19
|
def test_mobile_telecom_company_other(self):
|
|
20
|
-
tryton_telecom = FakeTelecom(
|
|
20
|
+
tryton_telecom = FakeTelecom("New Som Connexio")
|
|
21
21
|
|
|
22
|
-
telecom = TelecomCompany(
|
|
22
|
+
telecom = TelecomCompany("mobile", tryton_telecom)
|
|
23
23
|
|
|
24
|
-
self.assertEqual(str(telecom),
|
|
24
|
+
self.assertEqual(str(telecom), "Other")
|
|
25
25
|
|
|
26
26
|
def test_mobile_telecom_company(self):
|
|
27
|
-
tryton_telecom = FakeTelecom(
|
|
27
|
+
tryton_telecom = FakeTelecom("Aire / Nubip")
|
|
28
28
|
|
|
29
|
-
telecom = TelecomCompany(
|
|
29
|
+
telecom = TelecomCompany("mobile", tryton_telecom)
|
|
30
30
|
|
|
31
|
-
self.assertEqual(str(telecom),
|
|
31
|
+
self.assertEqual(str(telecom), "AireNubip")
|
|
32
32
|
|
|
33
33
|
def test_internet_telecom_company_none(self):
|
|
34
34
|
tryton_telecom = None
|
|
35
35
|
|
|
36
|
-
telecom = TelecomCompany(
|
|
36
|
+
telecom = TelecomCompany("internet", tryton_telecom)
|
|
37
37
|
|
|
38
|
-
self.assertEqual(str(telecom),
|
|
38
|
+
self.assertEqual(str(telecom), "None")
|
|
39
39
|
|
|
40
40
|
def test_internet_telecom_company_other(self):
|
|
41
|
-
tryton_telecom = FakeTelecom(
|
|
41
|
+
tryton_telecom = FakeTelecom("New Som Connexio")
|
|
42
42
|
|
|
43
|
-
telecom = TelecomCompany(
|
|
43
|
+
telecom = TelecomCompany("internet", tryton_telecom)
|
|
44
44
|
|
|
45
|
-
self.assertEqual(str(telecom),
|
|
45
|
+
self.assertEqual(str(telecom), "Other")
|
|
46
46
|
|
|
47
47
|
def test_broadband_telecom_company(self):
|
|
48
|
-
tryton_telecom = FakeTelecom(
|
|
48
|
+
tryton_telecom = FakeTelecom("Aire / Nubip")
|
|
49
49
|
|
|
50
|
-
telecom = TelecomCompany(
|
|
50
|
+
telecom = TelecomCompany("internet", tryton_telecom)
|
|
51
51
|
|
|
52
|
-
self.assertEqual(str(telecom),
|
|
52
|
+
self.assertEqual(str(telecom), "Nubip")
|
|
@@ -9,45 +9,102 @@ from otrs_somconnexio.exceptions import ServiceTypeNotAllowedError
|
|
|
9
9
|
class TicketFactoryTestCase(unittest.TestCase):
|
|
10
10
|
def setUp(self):
|
|
11
11
|
self.customer_data = Mock(spec=[])
|
|
12
|
-
self.service_data = Mock(spec=[
|
|
12
|
+
self.service_data = Mock(spec=["order_id", "type", "is_grouped_with_fiber"])
|
|
13
|
+
self.responsible_data = Mock(spec=["email"])
|
|
13
14
|
|
|
14
|
-
@patch(
|
|
15
|
+
@patch("otrs_somconnexio.otrs_models.ticket_factory.MobileTicket")
|
|
15
16
|
def test_build_mobile_ticket(self, MockMobileTicket):
|
|
16
|
-
self.service_data.
|
|
17
|
+
self.service_data.service_type = "mobile"
|
|
18
|
+
self.service_data.is_grouped_with_fiber = False
|
|
17
19
|
|
|
18
|
-
TicketFactory(
|
|
20
|
+
TicketFactory(
|
|
21
|
+
self.service_data, self.customer_data, self.responsible_data
|
|
22
|
+
).build()
|
|
19
23
|
|
|
20
24
|
MockMobileTicket.assert_called_once_with(
|
|
21
25
|
service_data=self.service_data,
|
|
22
|
-
customer_data=self.customer_data
|
|
26
|
+
customer_data=self.customer_data,
|
|
27
|
+
responsible_data=self.responsible_data,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
@patch("otrs_somconnexio.otrs_models.ticket_factory.MobilePausedTicket")
|
|
31
|
+
def test_build_mobile_paused_ticket_portability(self, MockMobilePausedTicket):
|
|
32
|
+
self.service_data.service_type = "mobile"
|
|
33
|
+
self.service_data.type = "portability"
|
|
34
|
+
self.service_data.is_grouped_with_fiber = True
|
|
35
|
+
|
|
36
|
+
TicketFactory(
|
|
37
|
+
self.service_data, self.customer_data, self.responsible_data
|
|
38
|
+
).build()
|
|
39
|
+
|
|
40
|
+
MockMobilePausedTicket.assert_called_once_with(
|
|
41
|
+
service_data=self.service_data,
|
|
42
|
+
customer_data=self.customer_data,
|
|
43
|
+
responsible_data=self.responsible_data,
|
|
23
44
|
)
|
|
24
45
|
|
|
25
|
-
@patch(
|
|
46
|
+
@patch("otrs_somconnexio.otrs_models.ticket_factory.MobilePausedTicket")
|
|
47
|
+
def test_build_mobile_paused_ticket_fiber_linked(self, MockMobilePausedTicket):
|
|
48
|
+
self.service_data.service_type = "mobile"
|
|
49
|
+
self.service_data.type = "new"
|
|
50
|
+
self.service_data.is_grouped_with_fiber = True
|
|
51
|
+
self.service_data.is_from_pack = True
|
|
52
|
+
|
|
53
|
+
TicketFactory(
|
|
54
|
+
self.service_data, self.customer_data, self.responsible_data
|
|
55
|
+
).build()
|
|
56
|
+
|
|
57
|
+
MockMobilePausedTicket.assert_called_once_with(
|
|
58
|
+
service_data=self.service_data,
|
|
59
|
+
customer_data=self.customer_data,
|
|
60
|
+
responsible_data=self.responsible_data,
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
@patch("otrs_somconnexio.otrs_models.ticket_factory.ADSLTicket")
|
|
26
64
|
def test_build_adsl_ticket(self, MockADSLTicket):
|
|
27
|
-
self.service_data.
|
|
65
|
+
self.service_data.service_type = "adsl"
|
|
28
66
|
|
|
29
|
-
TicketFactory(
|
|
67
|
+
TicketFactory(
|
|
68
|
+
self.service_data, self.customer_data, self.responsible_data
|
|
69
|
+
).build()
|
|
30
70
|
|
|
31
71
|
MockADSLTicket.assert_called_once_with(
|
|
32
72
|
service_data=self.service_data,
|
|
33
|
-
customer_data=self.customer_data
|
|
73
|
+
customer_data=self.customer_data,
|
|
74
|
+
responsible_data=self.responsible_data,
|
|
34
75
|
)
|
|
35
76
|
|
|
36
|
-
@patch(
|
|
77
|
+
@patch("otrs_somconnexio.otrs_models.ticket_factory.FiberTicket")
|
|
37
78
|
def test_build_fibre_ticket(self, MockFiberTicket):
|
|
38
|
-
self.service_data.
|
|
79
|
+
self.service_data.service_type = "fiber"
|
|
80
|
+
|
|
81
|
+
TicketFactory(
|
|
82
|
+
self.service_data, self.customer_data, self.responsible_data
|
|
83
|
+
).build()
|
|
84
|
+
|
|
85
|
+
MockFiberTicket.assert_called_once_with(
|
|
86
|
+
service_data=self.service_data,
|
|
87
|
+
customer_data=self.customer_data,
|
|
88
|
+
responsible_data=self.responsible_data,
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
@patch("otrs_somconnexio.otrs_models.ticket_factory.FiberTicket")
|
|
92
|
+
def test_build_fibre_ticket_without_responsible(self, MockFiberTicket):
|
|
93
|
+
self.service_data.service_type = "fiber"
|
|
39
94
|
|
|
40
95
|
TicketFactory(self.service_data, self.customer_data).build()
|
|
41
96
|
|
|
42
97
|
MockFiberTicket.assert_called_once_with(
|
|
43
98
|
service_data=self.service_data,
|
|
44
|
-
customer_data=self.customer_data
|
|
99
|
+
customer_data=self.customer_data,
|
|
100
|
+
responsible_data=None,
|
|
45
101
|
)
|
|
46
102
|
|
|
47
103
|
def test_build_service_not_allowed_error(self):
|
|
48
|
-
|
|
104
|
+
self.service_data.service_type = ""
|
|
49
105
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
ticket_factory.build
|
|
106
|
+
ticket_factory = TicketFactory(
|
|
107
|
+
self.service_data, self.customer_data, self.responsible_data
|
|
53
108
|
)
|
|
109
|
+
|
|
110
|
+
self.assertRaises(ServiceTypeNotAllowedError, ticket_factory.build)
|
|
@@ -4,20 +4,21 @@ from mock import Mock, patch
|
|
|
4
4
|
|
|
5
5
|
from otrs_somconnexio.otrs_models.vf_provisioning_article import VfProvisioningArticle
|
|
6
6
|
|
|
7
|
-
class VfProvisioningArticleTestCase(unittest.TestCase):
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
class VfProvisioningArticleTestCase(unittest.TestCase):
|
|
9
|
+
@patch("otrs_somconnexio.otrs_models.abstract_article.Article")
|
|
10
10
|
def test_call(self, MockArticle):
|
|
11
11
|
|
|
12
12
|
fake_provisioning_dict = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
"opportunity_id": "1-2HNXG6I",
|
|
14
|
+
"offer": "961447541",
|
|
15
|
+
"ticket": "1234",
|
|
16
16
|
}
|
|
17
17
|
expected_article_arguments = {
|
|
18
18
|
"Subject": "Aprovisionament del tiquet de Vodafone 1234",
|
|
19
19
|
"Body": "offer: 961447541\nopportunity_id: 1-2HNXG6I\nticket: 1234\n",
|
|
20
20
|
"ContentType": "text/plain; charset=utf8",
|
|
21
|
+
"IsVisibleForCustomer": "1",
|
|
21
22
|
}
|
|
22
23
|
VfProvisioningArticle(fake_provisioning_dict).call()
|
|
23
24
|
MockArticle.assert_called_once_with(expected_article_arguments)
|
|
File without changes
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
from otrs_somconnexio.otrs_models.configurations.changes.add_data import AddDataTicketConfiguration, AddDataTicketRequestedConfiguration
|
|
5
|
+
from otrs_somconnexio.otrs_models.ticket_types.add_data_ticket import AddDataTicket
|
|
6
|
+
|
|
7
|
+
username = "7456787G"
|
|
8
|
+
customer_code = "1234"
|
|
9
|
+
|
|
10
|
+
class TestCaseAddDataTicket:
|
|
11
|
+
def test_create(self, mocker):
|
|
12
|
+
OTRSClientMock = mocker.patch(
|
|
13
|
+
"otrs_somconnexio.otrs_models.ticket_types.base_ticket.OTRSClient",
|
|
14
|
+
return_value=mocker.Mock(),
|
|
15
|
+
)
|
|
16
|
+
TicketMock = mocker.patch(
|
|
17
|
+
"otrs_somconnexio.otrs_models.ticket_types.base_ticket.Ticket",
|
|
18
|
+
return_value=mocker.Mock(),
|
|
19
|
+
)
|
|
20
|
+
ArticleMock = mocker.patch(
|
|
21
|
+
"otrs_somconnexio.otrs_models.ticket_types.base_ticket.Article",
|
|
22
|
+
return_value=mocker.Mock(),
|
|
23
|
+
)
|
|
24
|
+
DynamicFieldMock = mocker.patch(
|
|
25
|
+
"otrs_somconnexio.otrs_models.ticket_types.base_ticket.DynamicField",
|
|
26
|
+
return_value=mocker.Mock(),
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
expected_ticket_data = {
|
|
30
|
+
"Title": AddDataTicketConfiguration.subject,
|
|
31
|
+
"QueueID": AddDataTicketConfiguration.queue_id,
|
|
32
|
+
"State": AddDataTicket._get_state(self),
|
|
33
|
+
"Type": AddDataTicket._get_type(self),
|
|
34
|
+
"Priority": AddDataTicket._get_priority(self),
|
|
35
|
+
"CustomerUser": customer_code,
|
|
36
|
+
"CustomerID": customer_code,
|
|
37
|
+
"Service": False,
|
|
38
|
+
}
|
|
39
|
+
expected_article_data = {
|
|
40
|
+
"Subject": AddDataTicketConfiguration.subject,
|
|
41
|
+
"Body": "-",
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
fields_dict = {
|
|
45
|
+
"phone_number": "666666666",
|
|
46
|
+
"new_product_code": "PRODUCT_CODE",
|
|
47
|
+
"subscription_email": "fakeemail@email.coop",
|
|
48
|
+
"language": "ca_ES",
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
AddDataTicket(
|
|
52
|
+
username,
|
|
53
|
+
customer_code,
|
|
54
|
+
fields_dict,
|
|
55
|
+
).create()
|
|
56
|
+
|
|
57
|
+
TicketMock.assert_called_once_with(expected_ticket_data)
|
|
58
|
+
ArticleMock.assert_called_once_with(expected_article_data)
|
|
59
|
+
calls = [
|
|
60
|
+
mocker.call(
|
|
61
|
+
"ProcessManagementProcessID", AddDataTicketConfiguration.process_id
|
|
62
|
+
),
|
|
63
|
+
mocker.call(
|
|
64
|
+
"ProcessManagementActivityID",
|
|
65
|
+
AddDataTicketConfiguration.activity_id,
|
|
66
|
+
),
|
|
67
|
+
mocker.call("liniaMobil", "666666666"),
|
|
68
|
+
mocker.call("productAbonamentDadesAddicionals", "PRODUCT_CODE"),
|
|
69
|
+
# TODO: Why are we using correuElectronic in this ticket?
|
|
70
|
+
mocker.call("correuElectronic", "fakeemail@email.coop"),
|
|
71
|
+
mocker.call("idioma", "ca_ES"),
|
|
72
|
+
]
|
|
73
|
+
DynamicFieldMock.assert_has_calls(calls)
|
|
74
|
+
OTRSClientMock.return_value.create_otrs_process_ticket.assert_called_once_with( # noqa
|
|
75
|
+
TicketMock.return_value,
|
|
76
|
+
article=ArticleMock.return_value,
|
|
77
|
+
dynamic_fields=[mocker.ANY for call in calls],
|
|
78
|
+
attachments=None,
|
|
79
|
+
)
|