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
|
@@ -6,22 +6,22 @@ from tests.data.otrs_raw_responses import OTRSTicketCreateResponse
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class TicketCreationResponseTestCase(unittest.TestCase):
|
|
9
|
-
|
|
9
|
+
"Test Ticket creation response parser"
|
|
10
10
|
|
|
11
11
|
def test_ticket_creation_parse_response_id(self):
|
|
12
|
-
|
|
12
|
+
"Instantiate a OTRSCreationTicketResponse from otrs_ticket_creation_response"
|
|
13
13
|
ticket = OTRSCreationTicketResponse(OTRSTicketCreateResponse)
|
|
14
14
|
|
|
15
15
|
self.assertEqual("1", ticket.id)
|
|
16
16
|
|
|
17
17
|
def test_ticket_creation_parse_response_number(self):
|
|
18
|
-
|
|
18
|
+
"Instantiate a OTRSCreationTicketResponse from otrs_ticket_creation_response"
|
|
19
19
|
ticket = OTRSCreationTicketResponse(OTRSTicketCreateResponse)
|
|
20
20
|
|
|
21
21
|
self.assertEqual("2018081300000001", ticket.number)
|
|
22
22
|
|
|
23
23
|
def test_ticket_creation_parse_response_article_id(self):
|
|
24
|
-
|
|
24
|
+
"Instantiate a OTRSCreationTicketResponse from otrs_ticket_creation_response"
|
|
25
25
|
ticket = OTRSCreationTicketResponse(OTRSTicketCreateResponse)
|
|
26
26
|
|
|
27
27
|
self.assertEqual("11", ticket.article_id)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
|
|
3
|
+
from mock import Mock, patch
|
|
4
|
+
from otrs_somconnexio.services.activate_change_tarriff_mobile_tickets import (
|
|
5
|
+
ActivateChangeTariffMobileTickets,
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ActivateChangeTariffMobileTicketsTestCase(unittest.TestCase):
|
|
10
|
+
@patch(
|
|
11
|
+
"otrs_somconnexio.services.base_get_ticket_by_number.OTRSClient",
|
|
12
|
+
return_value=Mock(
|
|
13
|
+
spec=[
|
|
14
|
+
"update_ticket",
|
|
15
|
+
"get_ticket_by_number",
|
|
16
|
+
]
|
|
17
|
+
),
|
|
18
|
+
)
|
|
19
|
+
@patch(
|
|
20
|
+
"otrs_somconnexio.services.activate_change_tarriff_mobile_tickets.DynamicField"
|
|
21
|
+
)
|
|
22
|
+
def test_run(self, MockDF, MockOTRSClient):
|
|
23
|
+
ticket_number = "123"
|
|
24
|
+
expected_df = object()
|
|
25
|
+
MockDF.return_value = expected_df
|
|
26
|
+
MockOTRSClient.return_value.get_ticket_by_number.return_value = Mock(
|
|
27
|
+
spec=["tid"]
|
|
28
|
+
)
|
|
29
|
+
MockOTRSClient.return_value.get_ticket_by_number.return_value.tid = 321
|
|
30
|
+
|
|
31
|
+
ActivateChangeTariffMobileTickets(ticket_number).run()
|
|
32
|
+
|
|
33
|
+
MockOTRSClient.return_value.get_ticket_by_number.assert_called_once_with(
|
|
34
|
+
ticket_number,
|
|
35
|
+
dynamic_fields=True,
|
|
36
|
+
)
|
|
37
|
+
MockOTRSClient.return_value.update_ticket.assert_called_once_with(
|
|
38
|
+
MockOTRSClient.return_value.get_ticket_by_number.return_value.tid,
|
|
39
|
+
article=None,
|
|
40
|
+
dynamic_fields=[expected_df],
|
|
41
|
+
)
|
|
42
|
+
MockDF.assert_called_once_with(
|
|
43
|
+
name="enviatMMOV",
|
|
44
|
+
value=1,
|
|
45
|
+
)
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from otrs_somconnexio.otrs_models.configurations.changes.change_email import (
|
|
3
|
+
ChangeEmailContractsConfiguration,
|
|
4
|
+
ChangeEmailPersonalConfiguration,
|
|
5
|
+
)
|
|
6
|
+
from otrs_somconnexio.otrs_models.configurations.changes.change_iban import (
|
|
7
|
+
ChangeIbanTicketConfiguration,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
from otrs_somconnexio.services.change_to_confirm_ticket import ChangeToConfirmTicket
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class TestChangeToConfirmTicket:
|
|
14
|
+
TOKEN = 593086396372
|
|
15
|
+
|
|
16
|
+
def _execute_and_assert(self, mocker, queue_id):
|
|
17
|
+
TICKET_ID = 1234
|
|
18
|
+
ticket_OTRS_fixture = mocker.Mock(
|
|
19
|
+
spec=[
|
|
20
|
+
"fields",
|
|
21
|
+
"field_get",
|
|
22
|
+
]
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
def field_get(f_name):
|
|
26
|
+
return ticket_OTRS_fixture.fields.get(f_name)
|
|
27
|
+
|
|
28
|
+
ticket_OTRS_fixture.fields = {"QueueID": queue_id, "TicketID": TICKET_ID}
|
|
29
|
+
ticket_OTRS_fixture.field_get = field_get
|
|
30
|
+
|
|
31
|
+
ChangeConfirmTicketInstance = ChangeToConfirmTicket()
|
|
32
|
+
|
|
33
|
+
ticket_searched_fixture = [TICKET_ID]
|
|
34
|
+
|
|
35
|
+
OTRSClientMock = mocker.patch(
|
|
36
|
+
"otrs_somconnexio.otrs_models.ticket_types.base_ticket.OTRSClient",
|
|
37
|
+
return_value=mocker.Mock(),
|
|
38
|
+
)
|
|
39
|
+
DynamicFieldMock = mocker.patch(
|
|
40
|
+
"otrs_somconnexio.otrs_models.ticket_types.base_ticket.DynamicField",
|
|
41
|
+
return_value=mocker.Mock(),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
OTRSClientMock.return_value.client.ticket_search.return_value = (
|
|
45
|
+
ticket_searched_fixture
|
|
46
|
+
)
|
|
47
|
+
OTRSClientMock.return_value.client.ticket_get_by_id.return_value = (
|
|
48
|
+
ticket_OTRS_fixture
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
ChangeConfirmTicketInstance.confirm(self.TOKEN)
|
|
52
|
+
|
|
53
|
+
DynamicFieldMock.assert_has_calls(
|
|
54
|
+
[
|
|
55
|
+
mocker.call("IDOV", search_patterns=self.TOKEN),
|
|
56
|
+
mocker.call("enviatOdooOV", True),
|
|
57
|
+
]
|
|
58
|
+
)
|
|
59
|
+
OTRSClientMock.return_value.client.ticket_search.assert_called_once_with(
|
|
60
|
+
dynamic_fields=[DynamicFieldMock.return_value]
|
|
61
|
+
)
|
|
62
|
+
OTRSClientMock.return_value.client.ticket_get_by_id.assert_called_once_with(
|
|
63
|
+
ticket_id=TICKET_ID
|
|
64
|
+
)
|
|
65
|
+
OTRSClientMock.return_value.client.ticket_update.assert_called_once_with(
|
|
66
|
+
TICKET_ID, article=None, dynamic_fields=[DynamicFieldMock.return_value], State=None, attachments=None
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
def test_confirm_change_iban(self, mocker):
|
|
70
|
+
self._execute_and_assert(mocker, ChangeIbanTicketConfiguration.queue_id)
|
|
71
|
+
|
|
72
|
+
def test_confirm_change_contract_email(self, mocker):
|
|
73
|
+
self._execute_and_assert(mocker, ChangeEmailContractsConfiguration.queue_id)
|
|
74
|
+
|
|
75
|
+
def test_confirm_change_user_email(self, mocker):
|
|
76
|
+
self._execute_and_assert(mocker, ChangeEmailPersonalConfiguration.queue_id)
|
|
77
|
+
|
|
78
|
+
def test_confirm_change_ticket_bad_queue(self, mocker):
|
|
79
|
+
with pytest.raises(Exception):
|
|
80
|
+
self._execute_and_assert(mocker, 0)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
|
|
3
|
+
from mock import ANY, Mock, patch
|
|
4
|
+
|
|
5
|
+
from otrs_somconnexio.services.get_mobile_related_tickets import GetMobileRelatedTickets
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class GetMobileRelatedTicketsTestCase(unittest.TestCase):
|
|
9
|
+
@patch(
|
|
10
|
+
"otrs_somconnexio.services.base_get_ticket_by_number.OTRSClient",
|
|
11
|
+
return_value=Mock(
|
|
12
|
+
spec=[
|
|
13
|
+
"get_ticket_by_number",
|
|
14
|
+
"get_linked_tickets",
|
|
15
|
+
]
|
|
16
|
+
),
|
|
17
|
+
)
|
|
18
|
+
def test_run(self, MockOTRSClient):
|
|
19
|
+
ticket_number = "123"
|
|
20
|
+
MockOTRSClient.return_value.get_ticket_by_number.return_value = Mock(
|
|
21
|
+
spec=["tid"]
|
|
22
|
+
)
|
|
23
|
+
MockOTRSClient.return_value.get_ticket_by_number.return_value.tid = 321
|
|
24
|
+
MockOTRSClient.return_value.get_linked_tickets.return_value = [ANY, ANY]
|
|
25
|
+
|
|
26
|
+
related_tickets = GetMobileRelatedTickets(ticket_number).run()
|
|
27
|
+
|
|
28
|
+
MockOTRSClient.return_value.get_ticket_by_number.assert_called_once_with(
|
|
29
|
+
ticket_number,
|
|
30
|
+
dynamic_fields=True,
|
|
31
|
+
)
|
|
32
|
+
MockOTRSClient.return_value.get_linked_tickets.assert_called_once_with(
|
|
33
|
+
MockOTRSClient.return_value.get_ticket_by_number.return_value.tid,
|
|
34
|
+
"Normal",
|
|
35
|
+
)
|
|
36
|
+
assert (
|
|
37
|
+
related_tickets
|
|
38
|
+
== MockOTRSClient.return_value.get_linked_tickets.return_value
|
|
39
|
+
)
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
from mock import Mock, patch
|
|
3
|
+
|
|
4
|
+
from otrs_somconnexio.otrs_models.configurations.provision.mobile_ticket import (
|
|
5
|
+
MobileTicketPlatformIntroducedConfiguration as PIConf,
|
|
6
|
+
MobileTicketActivationScheduledConfiguration as ASConf,
|
|
7
|
+
)
|
|
8
|
+
from otrs_somconnexio.services.get_sharing_data_mobile_tickets import (
|
|
9
|
+
GetSharingDataMobileTickets,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@patch(
|
|
14
|
+
"otrs_somconnexio.services.get_sharing_data_mobile_tickets.OTRSClient",
|
|
15
|
+
return_value=Mock(
|
|
16
|
+
spec=[
|
|
17
|
+
"get_linked_tickets",
|
|
18
|
+
]
|
|
19
|
+
),
|
|
20
|
+
)
|
|
21
|
+
class TestGetSharingDataMobileTickets(unittest.TestCase):
|
|
22
|
+
def setUp(self):
|
|
23
|
+
self.ticket_id = 1
|
|
24
|
+
self.ready_ticket = Mock(queue_id=ASConf.queue_id, state="new")
|
|
25
|
+
self.provisioned_ticket = Mock(
|
|
26
|
+
queue_id=PIConf.queue_id,
|
|
27
|
+
state="new",
|
|
28
|
+
shared_bond_id="id1",
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
def test_no_linked_tickets(self, MockOTRSClient):
|
|
32
|
+
MockOTRSClient.return_value.get_linked_tickets.return_value = []
|
|
33
|
+
|
|
34
|
+
result = GetSharingDataMobileTickets(self.ticket_id).run()
|
|
35
|
+
|
|
36
|
+
self.assertEqual(result, {})
|
|
37
|
+
|
|
38
|
+
def test_only_ready_mobile_tickets(self, MockOTRSClient):
|
|
39
|
+
MockOTRSClient.return_value.get_linked_tickets.return_value = [
|
|
40
|
+
self.ready_ticket
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
result = GetSharingDataMobileTickets(self.ticket_id).run()
|
|
44
|
+
|
|
45
|
+
self.assertEqual(len(result["ready_mobile_tickets"]), 1)
|
|
46
|
+
self.assertEqual(len(result["unready_mobile_tickets"]), 0)
|
|
47
|
+
|
|
48
|
+
def test_ready_and_unready_mobile_tickets(self, MockOTRSClient):
|
|
49
|
+
unready_ticket = Mock(queue_id="other_queue", state="open")
|
|
50
|
+
MockOTRSClient.return_value.get_linked_tickets.return_value = [
|
|
51
|
+
self.ready_ticket,
|
|
52
|
+
unready_ticket,
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
result = GetSharingDataMobileTickets(self.ticket_id).run()
|
|
56
|
+
|
|
57
|
+
self.assertEqual(len(result["ready_mobile_tickets"]), 1)
|
|
58
|
+
self.assertEqual(len(result["unready_mobile_tickets"]), 1)
|
|
59
|
+
|
|
60
|
+
def test_single_shared_bond_id(self, MockOTRSClient):
|
|
61
|
+
MockOTRSClient.return_value.get_linked_tickets.return_value = [
|
|
62
|
+
self.provisioned_ticket,
|
|
63
|
+
self.provisioned_ticket,
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
result = GetSharingDataMobileTickets(self.ticket_id).run()
|
|
67
|
+
|
|
68
|
+
self.assertEqual(result["shared_bond_id"], ["id1"])
|
|
69
|
+
|
|
70
|
+
def test_multiple_shared_bond_ids(self, MockOTRSClient):
|
|
71
|
+
provisioned_ticket_2 = Mock(
|
|
72
|
+
queue_id=PIConf.queue_id,
|
|
73
|
+
state="new",
|
|
74
|
+
shared_bond_id="id2",
|
|
75
|
+
)
|
|
76
|
+
MockOTRSClient.return_value.get_linked_tickets.return_value = [
|
|
77
|
+
self.provisioned_ticket,
|
|
78
|
+
provisioned_ticket_2,
|
|
79
|
+
]
|
|
80
|
+
|
|
81
|
+
result = GetSharingDataMobileTickets(self.ticket_id).run()
|
|
82
|
+
|
|
83
|
+
self.assertIn("id1", result["shared_bond_id"])
|
|
84
|
+
self.assertIn("id2", result["shared_bond_id"])
|
|
85
|
+
self.assertEqual(len(result["shared_bond_id"]), 2)
|
|
86
|
+
|
|
87
|
+
def test_extracted_ticket_data(self, MockOTRSClient):
|
|
88
|
+
ticket = Mock(
|
|
89
|
+
id=1,
|
|
90
|
+
number="T123",
|
|
91
|
+
service_type="mobile",
|
|
92
|
+
msisdn="123456789",
|
|
93
|
+
product_code="P001",
|
|
94
|
+
international_minutes=100,
|
|
95
|
+
fiber_contract_code="F001",
|
|
96
|
+
icc="ICC123",
|
|
97
|
+
donor_icc="DICC123",
|
|
98
|
+
previous_provider="ProviderX",
|
|
99
|
+
previous_owner_docid="DOC123",
|
|
100
|
+
previous_owner_name="John",
|
|
101
|
+
previous_owner_surname="Doe",
|
|
102
|
+
activation_date="2023-01-01",
|
|
103
|
+
queue_id=ASConf.queue_id,
|
|
104
|
+
state="new",
|
|
105
|
+
)
|
|
106
|
+
expected_data = {
|
|
107
|
+
"ticket_id": 1,
|
|
108
|
+
"ticket_number": "T123",
|
|
109
|
+
"mobile_service_type": "mobile",
|
|
110
|
+
"phone_number": "123456789",
|
|
111
|
+
"product_code": "P001",
|
|
112
|
+
"international_minutes": 100,
|
|
113
|
+
"fiber_contract_code": "F001",
|
|
114
|
+
"ICC_SC": "ICC123",
|
|
115
|
+
"donor_ICC": "DICC123",
|
|
116
|
+
"donor_operator": "ProviderX",
|
|
117
|
+
"docid": "DOC123",
|
|
118
|
+
"name": "John",
|
|
119
|
+
"surname": "Doe",
|
|
120
|
+
"activation_date": "2023-01-01",
|
|
121
|
+
}
|
|
122
|
+
MockOTRSClient.return_value.get_linked_tickets.return_value = [ticket]
|
|
123
|
+
|
|
124
|
+
result = GetSharingDataMobileTickets(self.ticket_id).run()
|
|
125
|
+
|
|
126
|
+
self.assertEqual(len(result["ready_mobile_tickets"]), 1)
|
|
127
|
+
self.assertEqual(result["ready_mobile_tickets"], [expected_data])
|
|
@@ -5,17 +5,17 @@ from otrs_somconnexio.services.mapping_mobile_minutes import ServiceMappingMobil
|
|
|
5
5
|
|
|
6
6
|
class ServiceMappingMobileMinutesTestCase(unittest.TestCase):
|
|
7
7
|
def test_mapping_0(self):
|
|
8
|
-
|
|
9
|
-
self.assertEqual("0", ServiceMappingMobileMinutes.minutes(
|
|
8
|
+
"Test the mapping of service Fibra"
|
|
9
|
+
self.assertEqual("0", ServiceMappingMobileMinutes.minutes("0min"))
|
|
10
10
|
|
|
11
11
|
def test_mapping_100(self):
|
|
12
|
-
|
|
13
|
-
self.assertEqual("100", ServiceMappingMobileMinutes.minutes(
|
|
12
|
+
"Test the mapping of service Fibra"
|
|
13
|
+
self.assertEqual("100", ServiceMappingMobileMinutes.minutes("100min"))
|
|
14
14
|
|
|
15
15
|
def test_mapping_200(self):
|
|
16
|
-
|
|
17
|
-
self.assertEqual("200", ServiceMappingMobileMinutes.minutes(
|
|
16
|
+
"Test the mapping of service Fibra"
|
|
17
|
+
self.assertEqual("200", ServiceMappingMobileMinutes.minutes("200min"))
|
|
18
18
|
|
|
19
19
|
def test_mapping_unlim(self):
|
|
20
|
-
|
|
21
|
-
self.assertEqual("unlimited", ServiceMappingMobileMinutes.minutes(
|
|
20
|
+
"Test the mapping of service Fibra"
|
|
21
|
+
self.assertEqual("unlimited", ServiceMappingMobileMinutes.minutes("unlim"))
|
|
@@ -4,20 +4,20 @@ from otrs_somconnexio.services.mapping_services import ServiceMappingServices
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class ServiceMappingServicesTestCase(unittest.TestCase):
|
|
7
|
-
|
|
7
|
+
"""Test service mapping services"""
|
|
8
8
|
|
|
9
9
|
def test_mapping_Fibra(self):
|
|
10
|
-
|
|
11
|
-
self.assertEqual("fiber", ServiceMappingServices.service(
|
|
10
|
+
"""Test the mapping of service Fibra"""
|
|
11
|
+
self.assertEqual("fiber", ServiceMappingServices.service("Fibra"))
|
|
12
12
|
|
|
13
13
|
def test_mapping_ADSL(self):
|
|
14
|
-
|
|
15
|
-
self.assertEqual("adsl", ServiceMappingServices.service(
|
|
14
|
+
"""Test the mapping of service ADSL"""
|
|
15
|
+
self.assertEqual("adsl", ServiceMappingServices.service("ADSL"))
|
|
16
16
|
|
|
17
17
|
def test_mapping_ADSL100(self):
|
|
18
|
-
|
|
19
|
-
self.assertEqual("adsl100", ServiceMappingServices.service(
|
|
18
|
+
"""Test the mapping of service ADSL + 100 min"""
|
|
19
|
+
self.assertEqual("adsl100", ServiceMappingServices.service("ADSL+100min"))
|
|
20
20
|
|
|
21
21
|
def test_mapping_ADSL1000(self):
|
|
22
|
-
|
|
23
|
-
self.assertEqual("adsl1000", ServiceMappingServices.service(
|
|
22
|
+
"""Test the mapping of service ADSL + 1000 min"""
|
|
23
|
+
self.assertEqual("adsl1000", ServiceMappingServices.service("ADSL+1000min"))
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
|
|
3
|
+
from mock import Mock, patch
|
|
4
|
+
from otrs_somconnexio.services.move_sharing_data_mobile_tickets import (
|
|
5
|
+
MoveSharingDataMobileTickets,
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class MoveSharingDataMobileTicketsTestCase(unittest.TestCase):
|
|
10
|
+
@patch(
|
|
11
|
+
"otrs_somconnexio.services.base_get_ticket_by_number.OTRSClient",
|
|
12
|
+
return_value=Mock(
|
|
13
|
+
spec=[
|
|
14
|
+
"update_ticket",
|
|
15
|
+
"get_ticket_by_number",
|
|
16
|
+
]
|
|
17
|
+
),
|
|
18
|
+
)
|
|
19
|
+
@patch("otrs_somconnexio.services.move_sharing_data_mobile_tickets.DynamicField")
|
|
20
|
+
def test_run(self, MockDF, MockOTRSClient):
|
|
21
|
+
ticket_number = "123"
|
|
22
|
+
expected_df = object()
|
|
23
|
+
MockDF.return_value = expected_df
|
|
24
|
+
MockOTRSClient.return_value.get_ticket_by_number.return_value = Mock(
|
|
25
|
+
spec=["tid"]
|
|
26
|
+
)
|
|
27
|
+
MockOTRSClient.return_value.get_ticket_by_number.return_value.tid = 321
|
|
28
|
+
|
|
29
|
+
MoveSharingDataMobileTickets(ticket_number).run()
|
|
30
|
+
|
|
31
|
+
MockOTRSClient.return_value.get_ticket_by_number.assert_called_once_with(
|
|
32
|
+
ticket_number,
|
|
33
|
+
dynamic_fields=True,
|
|
34
|
+
)
|
|
35
|
+
MockOTRSClient.return_value.update_ticket.assert_called_once_with(
|
|
36
|
+
MockOTRSClient.return_value.get_ticket_by_number.return_value.tid,
|
|
37
|
+
article=None,
|
|
38
|
+
dynamic_fields=[expected_df],
|
|
39
|
+
)
|
|
40
|
+
MockDF.assert_called_once_with(
|
|
41
|
+
name="compartidesEnProvisio",
|
|
42
|
+
value=1,
|
|
43
|
+
)
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
from otrs_somconnexio.otrs_models.configurations.changes.change_tariff import (
|
|
3
|
+
ChangeTariffSharedBondTicketConfiguration,
|
|
4
|
+
ChangeTariffTicketConfiguration,
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
from otrs_somconnexio.services.search_tickets_mobile_change_tariff import (
|
|
8
|
+
SearchMobileChangeTariff,
|
|
9
|
+
)
|
|
10
|
+
from mock import Mock, patch
|
|
11
|
+
|
|
12
|
+
customer_code = "123"
|
|
13
|
+
df_dct = {
|
|
14
|
+
"liniaMobil": [
|
|
15
|
+
"665195090",
|
|
16
|
+
"726326798",
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class SearchTicketsMobileChangeTariffTestCase(unittest.TestCase):
|
|
22
|
+
@patch(
|
|
23
|
+
"otrs_somconnexio.services.search_tickets_mobile_change_tariff.SearchTicketsService",
|
|
24
|
+
return_value=Mock(
|
|
25
|
+
spec=[
|
|
26
|
+
"search",
|
|
27
|
+
]
|
|
28
|
+
),
|
|
29
|
+
)
|
|
30
|
+
def test_default_search(self, MockSearchService):
|
|
31
|
+
expected_tickets = [Mock()]
|
|
32
|
+
MockSearchService.return_value.search.return_value = expected_tickets
|
|
33
|
+
result = SearchMobileChangeTariff(customer_code).search(df_dct)
|
|
34
|
+
MockSearchService.assert_called_once_with(
|
|
35
|
+
[
|
|
36
|
+
ChangeTariffTicketConfiguration,
|
|
37
|
+
ChangeTariffSharedBondTicketConfiguration,
|
|
38
|
+
]
|
|
39
|
+
)
|
|
40
|
+
MockSearchService.return_value.search.assert_called_once_with(
|
|
41
|
+
customer_code,
|
|
42
|
+
[
|
|
43
|
+
ChangeTariffTicketConfiguration.state,
|
|
44
|
+
],
|
|
45
|
+
df_dct,
|
|
46
|
+
)
|
|
47
|
+
assert result == expected_tickets
|
|
48
|
+
|
|
49
|
+
@patch(
|
|
50
|
+
"otrs_somconnexio.services.search_tickets_mobile_change_tariff.SearchTicketsService",
|
|
51
|
+
return_value=Mock(
|
|
52
|
+
spec=[
|
|
53
|
+
"search",
|
|
54
|
+
]
|
|
55
|
+
),
|
|
56
|
+
)
|
|
57
|
+
def test_extra_states_search(self, MockSearchService):
|
|
58
|
+
MockSearchService.return_value.search.return_value = [Mock()]
|
|
59
|
+
SearchMobileChangeTariff(customer_code).search(df_dct, ["extra_state"])
|
|
60
|
+
MockSearchService.return_value.search.assert_called_once_with(
|
|
61
|
+
customer_code,
|
|
62
|
+
[
|
|
63
|
+
"extra_state",
|
|
64
|
+
ChangeTariffTicketConfiguration.state,
|
|
65
|
+
],
|
|
66
|
+
df_dct,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
def test_constructor_configuration(self):
|
|
70
|
+
customer_code = "123"
|
|
71
|
+
instance = SearchMobileChangeTariff(customer_code)
|
|
72
|
+
self.assertEqual(
|
|
73
|
+
instance.search_types[0],
|
|
74
|
+
ChangeTariffTicketConfiguration,
|
|
75
|
+
)
|
|
76
|
+
self.assertEqual(
|
|
77
|
+
instance.search_types[1],
|
|
78
|
+
ChangeTariffSharedBondTicketConfiguration,
|
|
79
|
+
)
|
|
80
|
+
assert instance.search_states[0] == ChangeTariffTicketConfiguration.state
|
|
81
|
+
assert (
|
|
82
|
+
instance.search_states[1] == ChangeTariffSharedBondTicketConfiguration.state
|
|
83
|
+
)
|
|
84
|
+
assert instance.customer_code == customer_code
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
|
|
3
|
+
from mock import Mock, patch, call
|
|
4
|
+
|
|
5
|
+
from otrs_somconnexio.services.search_tickets_service import SearchTicketsService
|
|
6
|
+
from otrs_somconnexio.otrs_models.configurations.changes.change_tariff import (
|
|
7
|
+
ChangeTariffTicketConfiguration,
|
|
8
|
+
)
|
|
9
|
+
from otrs_somconnexio.otrs_models.configurations.provision.fiber_ticket import (
|
|
10
|
+
FiberTicketConfiguration,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class SearchTicketsServiceTestCase(unittest.TestCase):
|
|
15
|
+
@patch(
|
|
16
|
+
"otrs_somconnexio.services.search_tickets_service.OTRSClient",
|
|
17
|
+
return_value=Mock(
|
|
18
|
+
spec=[
|
|
19
|
+
"search_tickets",
|
|
20
|
+
]
|
|
21
|
+
),
|
|
22
|
+
)
|
|
23
|
+
@patch("otrs_somconnexio.services.search_tickets_service.DynamicField")
|
|
24
|
+
def test_search(self, MockDF, MockOTRSClient):
|
|
25
|
+
customer_code = "123"
|
|
26
|
+
state_list = ["new", "open"]
|
|
27
|
+
df_dct = {
|
|
28
|
+
"productMobil": [
|
|
29
|
+
"SE_SC_REC_MOBILE_PACK_UNL_20480",
|
|
30
|
+
"SE_SC_REC_MOBILE_T_UNL_1024",
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
service = SearchTicketsService(ChangeTariffTicketConfiguration)
|
|
34
|
+
calls = [
|
|
35
|
+
call(
|
|
36
|
+
"ProcessManagementProcessID",
|
|
37
|
+
search_patterns=[ChangeTariffTicketConfiguration.process_id],
|
|
38
|
+
),
|
|
39
|
+
call(
|
|
40
|
+
"ProcessManagementActivityID",
|
|
41
|
+
search_patterns=[ChangeTariffTicketConfiguration.activity_id],
|
|
42
|
+
),
|
|
43
|
+
call("productMobil", search_patterns=df_dct["productMobil"]),
|
|
44
|
+
]
|
|
45
|
+
expected_df = object()
|
|
46
|
+
MockDF.return_value = expected_df
|
|
47
|
+
expected_search_args = {
|
|
48
|
+
"dynamic_fields": [expected_df, expected_df, expected_df],
|
|
49
|
+
"QueueIDs": [ChangeTariffTicketConfiguration.queue_id],
|
|
50
|
+
"CustomerID": customer_code,
|
|
51
|
+
"States": state_list,
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
self.assertIn(ChangeTariffTicketConfiguration, service.configurations)
|
|
55
|
+
service.search(
|
|
56
|
+
customer_code=customer_code, state_list=state_list, df_dct=df_dct
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
MockDF.assert_has_calls(calls)
|
|
60
|
+
|
|
61
|
+
MockOTRSClient.return_value.search_tickets.assert_called_once_with(
|
|
62
|
+
**expected_search_args
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
@patch(
|
|
66
|
+
"otrs_somconnexio.services.search_tickets_service.OTRSClient",
|
|
67
|
+
return_value=Mock(
|
|
68
|
+
spec=[
|
|
69
|
+
"search_tickets",
|
|
70
|
+
]
|
|
71
|
+
),
|
|
72
|
+
)
|
|
73
|
+
@patch("otrs_somconnexio.services.search_tickets_service.DynamicField")
|
|
74
|
+
def test_search_no_customer_code_no_extra_df(self, MockDF, MockOTRSClient):
|
|
75
|
+
state_list = ["new", "open"]
|
|
76
|
+
service = SearchTicketsService(ChangeTariffTicketConfiguration)
|
|
77
|
+
calls = [
|
|
78
|
+
call(
|
|
79
|
+
"ProcessManagementProcessID",
|
|
80
|
+
search_patterns=[ChangeTariffTicketConfiguration.process_id],
|
|
81
|
+
),
|
|
82
|
+
call(
|
|
83
|
+
"ProcessManagementActivityID",
|
|
84
|
+
search_patterns=[ChangeTariffTicketConfiguration.activity_id],
|
|
85
|
+
),
|
|
86
|
+
]
|
|
87
|
+
expected_df = object()
|
|
88
|
+
MockDF.return_value = expected_df
|
|
89
|
+
expected_search_args = {
|
|
90
|
+
"dynamic_fields": [expected_df, expected_df],
|
|
91
|
+
"QueueIDs": [ChangeTariffTicketConfiguration.queue_id],
|
|
92
|
+
"States": state_list,
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
self.assertIn(ChangeTariffTicketConfiguration, service.configurations)
|
|
96
|
+
service.search(state_list=state_list)
|
|
97
|
+
|
|
98
|
+
MockDF.assert_has_calls(calls)
|
|
99
|
+
|
|
100
|
+
MockOTRSClient.return_value.search_tickets.assert_called_once_with(
|
|
101
|
+
**expected_search_args
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
@patch(
|
|
105
|
+
"otrs_somconnexio.services.search_tickets_service.OTRSClient",
|
|
106
|
+
return_value=Mock(
|
|
107
|
+
spec=[
|
|
108
|
+
"search_tickets",
|
|
109
|
+
]
|
|
110
|
+
),
|
|
111
|
+
)
|
|
112
|
+
@patch("otrs_somconnexio.services.search_tickets_service.DynamicField")
|
|
113
|
+
def test_search_multiple_configurations(self, MockDF, MockOTRSClient):
|
|
114
|
+
customer_code = "123"
|
|
115
|
+
state_list = ["new", "open"]
|
|
116
|
+
df_dct = {
|
|
117
|
+
"productMobil": [
|
|
118
|
+
"SE_SC_REC_MOBILE_PACK_UNL_20480",
|
|
119
|
+
"SE_SC_REC_MOBILE_T_UNL_1024",
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
service = SearchTicketsService(
|
|
124
|
+
[FiberTicketConfiguration, ChangeTariffTicketConfiguration]
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
self.assertIn(FiberTicketConfiguration, service.configurations)
|
|
128
|
+
self.assertIn(ChangeTariffTicketConfiguration, service.configurations)
|
|
129
|
+
|
|
130
|
+
calls = [
|
|
131
|
+
call(
|
|
132
|
+
"ProcessManagementProcessID",
|
|
133
|
+
search_patterns=[
|
|
134
|
+
FiberTicketConfiguration.process_id,
|
|
135
|
+
ChangeTariffTicketConfiguration.process_id,
|
|
136
|
+
],
|
|
137
|
+
),
|
|
138
|
+
call(
|
|
139
|
+
"ProcessManagementActivityID",
|
|
140
|
+
search_patterns=[
|
|
141
|
+
FiberTicketConfiguration.activity_id,
|
|
142
|
+
ChangeTariffTicketConfiguration.activity_id,
|
|
143
|
+
],
|
|
144
|
+
),
|
|
145
|
+
call("productMobil", search_patterns=df_dct["productMobil"]),
|
|
146
|
+
]
|
|
147
|
+
expected_df = object()
|
|
148
|
+
MockDF.return_value = expected_df
|
|
149
|
+
expected_search_args = {
|
|
150
|
+
"dynamic_fields": [expected_df, expected_df, expected_df],
|
|
151
|
+
"QueueIDs": [
|
|
152
|
+
FiberTicketConfiguration.queue_id,
|
|
153
|
+
ChangeTariffTicketConfiguration.queue_id,
|
|
154
|
+
],
|
|
155
|
+
"CustomerID": customer_code,
|
|
156
|
+
"States": state_list,
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
self.assertIn(ChangeTariffTicketConfiguration, service.configurations)
|
|
160
|
+
service.search(customer_code, state_list, df_dct)
|
|
161
|
+
|
|
162
|
+
MockDF.assert_has_calls(calls)
|
|
163
|
+
|
|
164
|
+
MockOTRSClient.return_value.search_tickets.assert_called_once_with(
|
|
165
|
+
**expected_search_args
|
|
166
|
+
)
|