diff --git a/src/didww/resources/configuration/h323.py b/src/didww/resources/configuration/h323.py deleted file mode 100644 index e73c2ee..0000000 --- a/src/didww/resources/configuration/h323.py +++ /dev/null @@ -1,41 +0,0 @@ -from didww.resources.configuration.base import TrunkConfiguration -from didww.enums import Codec, enum_value_list, to_enum_list - - -class H323Configuration(TrunkConfiguration): - _type = "h323_configurations" - - @property - def dst(self): - return self._attr("dst") - - @dst.setter - def dst(self, value): - self._set_attr("dst", value) - - @property - def host(self): - return self._attr("host") - - @host.setter - def host(self, value): - self._set_attr("host", value) - - @property - def port(self): - return self._attr("port") - - @port.setter - def port(self, value): - self._set_attr("port", value) - - @property - def codec_ids(self): - return to_enum_list(Codec, self._attr("codec_ids")) - - @codec_ids.setter - def codec_ids(self, value): - self._set_attr("codec_ids", enum_value_list(value)) - - -TrunkConfiguration.register("h323_configurations", H323Configuration) diff --git a/src/didww/resources/configuration/iax2.py b/src/didww/resources/configuration/iax2.py deleted file mode 100644 index f6ac2f4..0000000 --- a/src/didww/resources/configuration/iax2.py +++ /dev/null @@ -1,53 +0,0 @@ -from didww.resources.configuration.base import TrunkConfiguration -from didww.enums import Codec, enum_value_list, to_enum_list - - -class Iax2Configuration(TrunkConfiguration): - _type = "iax2_configurations" - - @property - def dst(self): - return self._attr("dst") - - @dst.setter - def dst(self, value): - self._set_attr("dst", value) - - @property - def host(self): - return self._attr("host") - - @host.setter - def host(self, value): - self._set_attr("host", value) - - @property - def port(self): - return self._attr("port") - - @port.setter - def port(self, value): - self._set_attr("port", value) - - @property - def codec_ids(self): - return to_enum_list(Codec, self._attr("codec_ids")) - - @codec_ids.setter - def codec_ids(self, value): - self._set_attr("codec_ids", enum_value_list(value)) - - @property - def auth_enabled(self): - return self._attr("auth_enabled") - - @property - def auth_user(self): - return self._attr("auth_user") - - @property - def auth_password(self): - return self._attr("auth_password") - - -TrunkConfiguration.register("iax2_configurations", Iax2Configuration) diff --git a/src/didww/resources/voice_in_trunk.py b/src/didww/resources/voice_in_trunk.py index 47ea008..debe190 100644 --- a/src/didww/resources/voice_in_trunk.py +++ b/src/didww/resources/voice_in_trunk.py @@ -4,8 +4,6 @@ # Import to register types import didww.resources.configuration.sip # noqa: F401 -import didww.resources.configuration.h323 # noqa: F401 -import didww.resources.configuration.iax2 # noqa: F401 import didww.resources.configuration.pstn # noqa: F401 diff --git a/tests/fixtures/voice_in_trunk_groups/create.yaml b/tests/fixtures/voice_in_trunk_groups/create.yaml index b52d1c3..58d8cca 100644 --- a/tests/fixtures/voice_in_trunk_groups/create.yaml +++ b/tests/fixtures/voice_in_trunk_groups/create.yaml @@ -31,11 +31,25 @@ interactions: : 65535,\n \"name\": \"test custom11\",\n \"cli_format\": \"\ e164\",\n \"cli_prefix\": \"+\",\n \"description\": \"\",\n\ \ \"ringing_timeout\": null,\n \"configuration\": {\n \ - \ \"type\": \"h323_configurations\",\n \"attributes\": {\n \ - \ \"dst\": \"{CALL_DID}\",\n \"host\": \"127.0.0.1\",\n\ - \ \"port\": null,\n \"codec_ids\": [\n \ - \ 9,\n 8,\n 6\n ]\n }\n \ - \ },\n \"created_at\": \"2015-05-03T13:38:21.000Z\"\n },\n\ + \ \"type\": \"sip_configurations\",\n \"attributes\": {\n \ + \ \"username\": \"{CALL_DID}\",\n \"host\": \"127.0.0.1\"\ + ,\n \"port\": null,\n \"codec_ids\": [\n \ + \ 9,\n 8,\n 6\n ],\n \"\ + rx_dtmf_format_id\": 1,\n \"tx_dtmf_format_id\": 1,\n \ + \ \"resolve_ruri\": false,\n \"auth_enabled\": false,\n \ + \ \"auth_user\": null,\n \"auth_password\": null,\n \ + \ \"auth_from_user\": null,\n \"auth_from_domain\": null,\n\ + \ \"sst_enabled\": false,\n \"sst_min_timer\": 600,\n\ + \ \"sst_max_timer\": 900,\n \"sst_accept_501\": true,\n\ + \ \"sip_timer_b\": 8000,\n \"dns_srv_failover_timer\"\ + : 2000,\n \"rtp_ping\": false,\n \"rtp_timeout\": 30,\n\ + \ \"force_symmetric_rtp\": false,\n \"symmetric_rtp_ignore_rtcp\"\ + : false,\n \"rerouting_disconnect_code_ids\": null,\n \ + \ \"sst_session_expires\": null,\n \"sst_refresh_method_id\"\ + : 1,\n \"transport_protocol_id\": 1,\n \"max_transfers\"\ + : 0,\n \"max_30x_redirects\": 0,\n \"media_encryption_mode\"\ + : \"disabled\",\n \"stir_shaken_mode\": \"disabled\",\n \ + \ \"allowed_rtp_ips\": null\n }\n },\n \"created_at\": \"2015-05-03T13:38:21.000Z\"\n },\n\ \ \"relationships\": {\n \"voice_in_trunk_group\": {\n \ \ \"links\": {\n \"self\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/7c15bca2-7f17-46fb-9486-7e2a17158c7e/relationships/voice_in_trunk_group\"\ ,\n \"related\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/7c15bca2-7f17-46fb-9486-7e2a17158c7e/voice_in_trunk_group\"\ diff --git a/tests/fixtures/voice_in_trunks/create_5.yaml b/tests/fixtures/voice_in_trunks/create_5.yaml deleted file mode 100644 index 1ecf2f6..0000000 --- a/tests/fixtures/voice_in_trunks/create_5.yaml +++ /dev/null @@ -1,40 +0,0 @@ -interactions: -- request: - body: null - headers: - Accept: - - application/vnd.api+json - Api-Key: - - test-api-key - Content-Type: - - application/vnd.api+json - method: POST - uri: https://sandbox-api.didww.com/v3/voice_in_trunks - response: - body: - string: "{\n \"data\": {\n \"id\": \"2021b895-52c9-4f65-990b-e57a1abf858d\"\ - ,\n \"type\": \"voice_in_trunks\",\n \"attributes\": {\n \"priority\"\ - : 1,\n \"capacity_limit\": null,\n \"weight\": 65535,\n \"\ - name\": \"hello, test iax2 trunk\",\n \"cli_format\": \"e164\",\n \ - \ \"cli_prefix\": null,\n \"description\": null,\n \"ringing_timeout\"\ - : null,\n \"configuration\": {\n \"type\": \"iax2_configurations\"\ - ,\n \"attributes\": {\n \"dst\": \"558540420024\",\n \ - \ \"host\": \"example.com\",\n \"port\": 4569,\n \"\ - auth_user\": \"auth_user\",\n \"auth_password\": \"auth_password\"\ - ,\n \"codec_ids\": [\n 9,\n 10,\n \ - \ 8,\n 7,\n 6\n ]\n }\n },\n\ - \ \"created_at\": \"2018-12-29T10:07:53.374Z\"\n },\n \"relationships\"\ - : {\n \"voice_in_trunk_group\": {\n \"links\": {\n \"\ - self\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/2021b895-52c9-4f65-990b-e57a1abf858d/relationships/voice_in_trunk_group\"\ - ,\n \"related\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/2021b895-52c9-4f65-990b-e57a1abf858d/voice_in_trunk_group\"\ - \n }\n },\n \"pop\": {\n \"links\": {\n \"\ - self\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/2021b895-52c9-4f65-990b-e57a1abf858d/relationships/pop\"\ - ,\n \"related\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/2021b895-52c9-4f65-990b-e57a1abf858d/pop\"\ - \n }\n }\n }\n }\n}" - headers: - Content-Type: - - application/vnd.api+json - status: - code: 201 - message: Created -version: 1 diff --git a/tests/fixtures/voice_in_trunks/create_6.yaml b/tests/fixtures/voice_in_trunks/create_6.yaml deleted file mode 100644 index 48c4ed0..0000000 --- a/tests/fixtures/voice_in_trunks/create_6.yaml +++ /dev/null @@ -1,39 +0,0 @@ -interactions: -- request: - body: null - headers: - Accept: - - application/vnd.api+json - Api-Key: - - test-api-key - Content-Type: - - application/vnd.api+json - method: POST - uri: https://sandbox-api.didww.com/v3/voice_in_trunks - response: - body: - string: "{\n \"data\": {\n \"id\": \"c6fbfd81-094a-4c5b-8447-e68cfe9d711e\"\ - ,\n \"type\": \"voice_in_trunks\",\n \"attributes\": {\n \"priority\"\ - : 1,\n \"capacity_limit\": null,\n \"weight\": 65535,\n \"\ - name\": \"hello, test h323 trunk\",\n \"cli_format\": \"e164\",\n \ - \ \"cli_prefix\": null,\n \"description\": null,\n \"ringing_timeout\"\ - : null,\n \"configuration\": {\n \"type\": \"iax2_configurations\"\ - ,\n \"attributes\": {\n \"dst\": \"558540420024\",\n \ - \ \"host\": \"example.com\",\n \"port\": 4569,\n \"\ - auth_user\": null,\n \"auth_password\": null,\n \"codec_ids\"\ - : [\n 9,\n 10,\n 8,\n 7,\n \ - \ 6\n ]\n }\n },\n \"created_at\": \"2018-12-29T10:13:56.189Z\"\ - \n },\n \"relationships\": {\n \"voice_in_trunk_group\": {\n \ - \ \"links\": {\n \"self\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/c6fbfd81-094a-4c5b-8447-e68cfe9d711e/relationships/voice_in_trunk_group\"\ - ,\n \"related\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/c6fbfd81-094a-4c5b-8447-e68cfe9d711e/voice_in_trunk_group\"\ - \n }\n },\n \"pop\": {\n \"links\": {\n \"\ - self\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/c6fbfd81-094a-4c5b-8447-e68cfe9d711e/relationships/pop\"\ - ,\n \"related\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/c6fbfd81-094a-4c5b-8447-e68cfe9d711e/pop\"\ - \n }\n }\n }\n }\n}" - headers: - Content-Type: - - application/vnd.api+json - status: - code: 201 - message: Created -version: 1 diff --git a/tests/fixtures/voice_in_trunks/create_8.yaml b/tests/fixtures/voice_in_trunks/create_8.yaml deleted file mode 100644 index 1095b42..0000000 --- a/tests/fixtures/voice_in_trunks/create_8.yaml +++ /dev/null @@ -1,38 +0,0 @@ -interactions: -- request: - body: null - headers: - Accept: - - application/vnd.api+json - Api-Key: - - test-api-key - Content-Type: - - application/vnd.api+json - method: POST - uri: https://sandbox-api.didww.com/v3/voice_in_trunks - response: - body: - string: "{\n \"data\": {\n \"id\": \"78146511-7648-45ba-9b26-a4b2cf87db06\"\ - ,\n \"type\": \"voice_in_trunks\",\n \"attributes\": {\n \"priority\"\ - : 1,\n \"capacity_limit\": null,\n \"weight\": 65535,\n \"\ - name\": \"hello, test h323 trunk\",\n \"cli_format\": \"e164\",\n \ - \ \"cli_prefix\": null,\n \"description\": null,\n \"ringing_timeout\"\ - : null,\n \"configuration\": {\n \"type\": \"h323_configurations\"\ - ,\n \"attributes\": {\n \"dst\": \"558540420024\",\n \ - \ \"host\": \"example.com\",\n \"port\": 4569,\n \"\ - codec_ids\": [\n 9,\n 10,\n 8,\n \ - \ 7,\n 6\n ]\n }\n },\n \"created_at\"\ - : \"2018-12-29T10:20:50.396Z\"\n },\n \"relationships\": {\n \"\ - voice_in_trunk_group\": {\n \"links\": {\n \"self\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/78146511-7648-45ba-9b26-a4b2cf87db06/relationships/voice_in_trunk_group\"\ - ,\n \"related\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/78146511-7648-45ba-9b26-a4b2cf87db06/voice_in_trunk_group\"\ - \n }\n },\n \"pop\": {\n \"links\": {\n \"\ - self\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/78146511-7648-45ba-9b26-a4b2cf87db06/relationships/pop\"\ - ,\n \"related\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/78146511-7648-45ba-9b26-a4b2cf87db06/pop\"\ - \n }\n }\n }\n }\n}" - headers: - Content-Type: - - application/vnd.api+json - status: - code: 201 - message: Created -version: 1 diff --git a/tests/fixtures/voice_in_trunks/list.yaml b/tests/fixtures/voice_in_trunks/list.yaml index 5bb1a81..28bf9dc 100644 --- a/tests/fixtures/voice_in_trunks/list.yaml +++ b/tests/fixtures/voice_in_trunks/list.yaml @@ -12,88 +12,49 @@ interactions: uri: https://sandbox-api.didww.com/v3/voice_in_trunks response: body: - string: "{\n \"data\": [\n {\n \"id\": \"9cbadd6f-0665-46bc-b3aa-687d22157808\"\ + string: "{\n \"data\": [\n {\n \"id\": \"2b4b1fcf-fe6a-4de9-8a58-7df46820ba13\"\ ,\n \"type\": \"voice_in_trunks\",\n \"attributes\": {\n \ \ \"priority\": 1,\n \"capacity_limit\": null,\n \"weight\"\ - : 65535,\n \"name\": \"iax2 trunk sample\",\n \"cli_format\"\ + : 65535,\n \"name\": \"sample trunk pstn\",\n \"cli_format\"\ : \"e164\",\n \"cli_prefix\": \"\",\n \"description\": \"\"\ ,\n \"ringing_timeout\": null,\n \"configuration\": {\n \ - \ \"type\": \"iax2_configurations\",\n \"attributes\": {\n \ - \ \"dst\": \"{DID}\",\n \"host\": \"216.58.215.78\",\n\ - \ \"port\": 4569,\n \"auth_user\": \"auth_user\",\n\ - \ \"auth_password\": \"auth_password\",\n \"codec_ids\"\ - : [\n 9,\n 6,\n 10,\n \ - \ 8\n ]\n }\n },\n \"created_at\": \"2018-12-28T15:11:49.330Z\"\ - \n },\n \"relationships\": {\n \"voice_in_trunk_group\":\ - \ {\n \"links\": {\n \"self\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/9cbadd6f-0665-46bc-b3aa-687d22157808/relationships/voice_in_trunk_group\"\ - ,\n \"related\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/9cbadd6f-0665-46bc-b3aa-687d22157808/voice_in_trunk_group\"\ - \n },\n \"data\": {\n \"type\": \"voice_in_trunk_groups\"\ - ,\n \"id\": \"837c5764-a6c3-456f-aa37-71fc8f8ca07b\"\n \ - \ }\n },\n \"pop\": {\n \"links\": {\n \ - \ \"self\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/9cbadd6f-0665-46bc-b3aa-687d22157808/relationships/pop\"\ - ,\n \"related\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/9cbadd6f-0665-46bc-b3aa-687d22157808/pop\"\ - \n },\n \"data\": null\n }\n }\n },\n \ - \ {\n \"id\": \"2b4b1fcf-fe6a-4de9-8a58-7df46820ba13\",\n \"type\"\ - : \"voice_in_trunks\",\n \"attributes\": {\n \"priority\": 1,\n\ - \ \"capacity_limit\": null,\n \"weight\": 65535,\n \"\ - name\": \"sample trunk pstn\",\n \"cli_format\": \"e164\",\n \ - \ \"cli_prefix\": \"\",\n \"description\": \"\",\n \"ringing_timeout\"\ - : null,\n \"configuration\": {\n \"type\": \"pstn_configurations\"\ - ,\n \"attributes\": {\n \"dst\": \"442080995011\"\n \ - \ }\n },\n \"created_at\": \"2018-12-28T15:03:48.751Z\"\ - \n },\n \"relationships\": {\n \"voice_in_trunk_group\":\ - \ {\n \"links\": {\n \"self\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/2b4b1fcf-fe6a-4de9-8a58-7df46820ba13/relationships/voice_in_trunk_group\"\ + \ \"type\": \"pstn_configurations\",\n \"attributes\": {\n \ + \ \"dst\": \"442080995011\"\n }\n },\n \"\ + created_at\": \"2018-12-28T15:03:48.751Z\"\n },\n \"relationships\"\ + : {\n \"voice_in_trunk_group\": {\n \"links\": {\n \ + \ \"self\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/2b4b1fcf-fe6a-4de9-8a58-7df46820ba13/relationships/voice_in_trunk_group\"\ ,\n \"related\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/2b4b1fcf-fe6a-4de9-8a58-7df46820ba13/voice_in_trunk_group\"\ \n },\n \"data\": null\n },\n \"pop\": {\n\ \ \"links\": {\n \"self\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/2b4b1fcf-fe6a-4de9-8a58-7df46820ba13/relationships/pop\"\ ,\n \"related\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/2b4b1fcf-fe6a-4de9-8a58-7df46820ba13/pop\"\ \n },\n \"data\": null\n }\n }\n },\n \ - \ {\n \"id\": \"cae43c7c-3c62-429a-b4ff-210e511cafab\",\n \"type\"\ + \ {\n \"id\": \"24cec518-da51-4274-9a4b-1aad910b996f\",\n \"type\"\ : \"voice_in_trunks\",\n \"attributes\": {\n \"priority\": 1,\n\ \ \"capacity_limit\": null,\n \"weight\": 65535,\n \"\ - name\": \"h323 trunk sample\",\n \"cli_format\": \"raw\",\n \ - \ \"cli_prefix\": \"\",\n \"description\": \"\",\n \"ringing_timeout\"\ - : null,\n \"configuration\": {\n \"type\": \"h323_configurations\"\ - ,\n \"attributes\": {\n \"dst\": \"{DID}\",\n \ - \ \"host\": \"216.58.215.78\",\n \"port\": 5060,\n \ - \ \"codec_ids\": [\n 9,\n 8,\n 6\n\ - \ ]\n }\n },\n \"created_at\": \"2018-12-28T15:02:27.821Z\"\ + name\": \"Sip trunk sample\",\n \"cli_format\": \"local\",\n \ + \ \"cli_prefix\": \"\",\n \"description\": \"\",\n \"ringing_timeout\"\ + : null,\n \"configuration\": {\n \"type\": \"sip_configurations\"\ + ,\n \"attributes\": {\n \"username\": \"username\",\n\ + \ \"host\": \"216.58.215.78\",\n \"port\": 8060,\n \ + \ \"codec_ids\": [\n 9,\n 10,\n \ + \ 8\n ],\n \"rx_dtmf_format_id\": 1,\n \ + \ \"tx_dtmf_format_id\": 1,\n \"resolve_ruri\": true,\n \ + \ \"auth_enabled\": true,\n \"auth_user\": \"auth_user\"\ + ,\n \"auth_password\": \"auth_password\",\n \"auth_from_user\"\ + : \"\",\n \"auth_from_domain\": \"\",\n \"sst_enabled\"\ + : false,\n \"sst_min_timer\": 600,\n \"sst_max_timer\"\ + : 900,\n \"sst_accept_501\": true,\n \"sip_timer_b\"\ + : 8000,\n \"dns_srv_failover_timer\": 2000,\n \"rtp_ping\"\ + : false,\n \"rtp_timeout\": 30,\n \"force_symmetric_rtp\"\ + : false,\n \"symmetric_rtp_ignore_rtcp\": false,\n \"\ + rerouting_disconnect_code_ids\": null,\n \"sst_session_expires\"\ + : null,\n \"sst_refresh_method_id\": 1,\n \"transport_protocol_id\"\ + : 1,\n \"max_transfers\": 2,\n \"max_30x_redirects\"\ + : 5,\n \"media_encryption_mode\": \"disabled\",\n \"\ + stir_shaken_mode\": \"disabled\",\n \"allowed_rtp_ips\": null\n\ + \ }\n },\n \"created_at\": \"2018-12-28T15:00:43.522Z\"\ \n },\n \"relationships\": {\n \"voice_in_trunk_group\":\ - \ {\n \"links\": {\n \"self\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/cae43c7c-3c62-429a-b4ff-210e511cafab/relationships/voice_in_trunk_group\"\ - ,\n \"related\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/cae43c7c-3c62-429a-b4ff-210e511cafab/voice_in_trunk_group\"\ - \n },\n \"data\": null\n },\n \"pop\": {\n\ - \ \"links\": {\n \"self\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/cae43c7c-3c62-429a-b4ff-210e511cafab/relationships/pop\"\ - ,\n \"related\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/cae43c7c-3c62-429a-b4ff-210e511cafab/pop\"\ - \n },\n \"data\": {\n \"type\": \"pops\",\n \ - \ \"id\": \"f402ddc7-0ef9-486d-85f3-6278f1417dd0\"\n }\n\ - \ }\n }\n },\n {\n \"id\": \"24cec518-da51-4274-9a4b-1aad910b996f\"\ - ,\n \"type\": \"voice_in_trunks\",\n \"attributes\": {\n \ - \ \"priority\": 1,\n \"capacity_limit\": null,\n \"weight\"\ - : 65535,\n \"name\": \"Sip trunk sample\",\n \"cli_format\"\ - : \"local\",\n \"cli_prefix\": \"\",\n \"description\": \"\"\ - ,\n \"ringing_timeout\": null,\n \"configuration\": {\n \ - \ \"type\": \"sip_configurations\",\n \"attributes\": {\n \ - \ \"username\": \"username\",\n \"host\": \"216.58.215.78\"\ - ,\n \"port\": 8060,\n \"codec_ids\": [\n \ - \ 9,\n 10,\n 8\n ],\n \"\ - rx_dtmf_format_id\": 1,\n \"tx_dtmf_format_id\": 1,\n \ - \ \"resolve_ruri\": true,\n \"auth_enabled\": true,\n \ - \ \"auth_user\": \"auth_user\",\n \"auth_password\": \"auth_password\"\ - ,\n \"auth_from_user\": \"\",\n \"auth_from_domain\"\ - : \"\",\n \"sst_enabled\": false,\n \"sst_min_timer\"\ - : 600,\n \"sst_max_timer\": 900,\n \"sst_accept_501\"\ - : true,\n \"sip_timer_b\": 8000,\n \"dns_srv_failover_timer\"\ - : 2000,\n \"rtp_ping\": false,\n \"rtp_timeout\": 30,\n\ - \ \"force_symmetric_rtp\": false,\n \"symmetric_rtp_ignore_rtcp\"\ - : false,\n \"rerouting_disconnect_code_ids\": null,\n \ - \ \"sst_session_expires\": null,\n \"sst_refresh_method_id\"\ - : 1,\n \"transport_protocol_id\": 1,\n \"max_transfers\"\ - : 2,\n \"max_30x_redirects\": 5,\n \"media_encryption_mode\"\ - : \"disabled\",\n \"stir_shaken_mode\": \"disabled\",\n \ - \ \"allowed_rtp_ips\": null\n }\n },\n \"created_at\"\ - : \"2018-12-28T15:00:43.522Z\"\n },\n \"relationships\": {\n \ - \ \"voice_in_trunk_group\": {\n \"links\": {\n \"\ - self\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/24cec518-da51-4274-9a4b-1aad910b996f/relationships/voice_in_trunk_group\"\ + \ {\n \"links\": {\n \"self\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/24cec518-da51-4274-9a4b-1aad910b996f/relationships/voice_in_trunk_group\"\ ,\n \"related\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/24cec518-da51-4274-9a4b-1aad910b996f/voice_in_trunk_group\"\ \n },\n \"data\": null\n },\n \"pop\": {\n\ \ \"links\": {\n \"self\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/24cec518-da51-4274-9a4b-1aad910b996f/relationships/pop\"\ @@ -108,11 +69,9 @@ interactions: : {\n \"links\": {\n \"self\": \"https://sandbox-api.didww.com/v3/voice_in_trunk_groups/837c5764-a6c3-456f-aa37-71fc8f8ca07b/relationships/voice_in_trunks\"\ ,\n \"related\": \"https://sandbox-api.didww.com/v3/voice_in_trunk_groups/837c5764-a6c3-456f-aa37-71fc8f8ca07b/voice_in_trunks\"\ \n }\n }\n },\n \"meta\": {\n \"trunks_count\"\ - : 3\n }\n },\n {\n \"id\": \"f402ddc7-0ef9-486d-85f3-6278f1417dd0\"\ - ,\n \"type\": \"pops\",\n \"attributes\": {\n \"name\": \"\ - US, LA\"\n }\n },\n {\n \"id\": \"ba7ccbef-82ac-4372-9391-eac90d5c9479\"\ + : 2\n }\n },\n {\n \"id\": \"ba7ccbef-82ac-4372-9391-eac90d5c9479\"\ ,\n \"type\": \"pops\",\n \"attributes\": {\n \"name\": \"\ - DE, FRA\"\n }\n }\n ],\n \"meta\": {\n \"total_records\": 70\n\ + DE, FRA\"\n }\n }\n ],\n \"meta\": {\n \"total_records\": 68\n\ \ },\n \"links\": {\n \"first\": \"https://sandbox-api.didww.com/v3/voice_in_trunks?include=trunk_group%2Cpop&page%5Bnumber%5D=1&page%5Bsize%5D=4&sort=-created_at\"\ ,\n \"next\": \"https://sandbox-api.didww.com/v3/voice_in_trunks?include=trunk_group%2Cpop&page%5Bnumber%5D=2&page%5Bsize%5D=4&sort=-created_at\"\ ,\n \"last\": \"https://sandbox-api.didww.com/v3/voice_in_trunks?include=trunk_group%2Cpop&page%5Bnumber%5D=18&page%5Bsize%5D=4&sort=-created_at\"\ diff --git a/tests/fixtures/voice_in_trunks/update.yaml b/tests/fixtures/voice_in_trunks/update.yaml deleted file mode 100644 index 66cffa5..0000000 --- a/tests/fixtures/voice_in_trunks/update.yaml +++ /dev/null @@ -1,54 +0,0 @@ -interactions: -- request: - body: null - headers: - Accept: - - application/vnd.api+json - Api-Key: - - test-api-key - Content-Type: - - application/vnd.api+json - method: PATCH - uri: https://sandbox-api.didww.com/v3/voice_in_trunks/2021b895-52c9-4f65-990b-e57a1abf858d - response: - body: - string: "{\n \"data\": {\n \"id\": \"2021b895-52c9-4f65-990b-e57a1abf858d\"\ - ,\n \"type\": \"voice_in_trunks\",\n \"attributes\": {\n \"priority\"\ - : 1,\n \"capacity_limit\": null,\n \"weight\": 65535,\n \"\ - name\": \"hello, updated test iax2 trunk\",\n \"cli_format\": \"e164\"\ - ,\n \"cli_prefix\": null,\n \"description\": null,\n \"ringing_timeout\"\ - : null,\n \"configuration\": {\n \"type\": \"iax2_configurations\"\ - ,\n \"attributes\": {\n \"dst\": \"558540420024\",\n \ - \ \"host\": \"example.com\",\n \"port\": 4567,\n \"\ - auth_user\": \"new_auth_user\",\n \"auth_password\": \"new_auth_password\"\ - ,\n \"codec_ids\": [\n 9,\n 10,\n \ - \ 8,\n 7,\n 6\n ]\n }\n },\n\ - \ \"created_at\": \"2018-12-29T10:07:53.374Z\"\n },\n \"relationships\"\ - : {\n \"voice_in_trunk_group\": {\n \"links\": {\n \"\ - self\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/2021b895-52c9-4f65-990b-e57a1abf858d/relationships/voice_in_trunk_group\"\ - ,\n \"related\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/2021b895-52c9-4f65-990b-e57a1abf858d/voice_in_trunk_group\"\ - \n },\n \"data\": {\n \"type\": \"voice_in_trunk_groups\"\ - ,\n \"id\": \"837c5764-a6c3-456f-aa37-71fc8f8ca07b\"\n }\n\ - \ },\n \"pop\": {\n \"links\": {\n \"self\": \"\ - https://sandbox-api.didww.com/v3/voice_in_trunks/2021b895-52c9-4f65-990b-e57a1abf858d/relationships/pop\"\ - ,\n \"related\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/2021b895-52c9-4f65-990b-e57a1abf858d/pop\"\ - \n },\n \"data\": {\n \"type\": \"pops\",\n \ - \ \"id\": \"ba7ccbef-82ac-4372-9391-eac90d5c9479\"\n }\n }\n\ - \ }\n },\n \"included\": [\n {\n \"id\": \"837c5764-a6c3-456f-aa37-71fc8f8ca07b\"\ - ,\n \"type\": \"voice_in_trunk_groups\",\n \"attributes\": {\n \ - \ \"created_at\": \"2017-11-14T15:07:25.571Z\",\n \"name\": \"\ - sample trunk group\",\n \"capacity_limit\": null\n },\n \"\ - relationships\": {\n \"voice_in_trunks\": {\n \"links\": {\n\ - \ \"self\": \"https://sandbox-api.didww.com/v3/voice_in_trunk_groups/837c5764-a6c3-456f-aa37-71fc8f8ca07b/relationships/voice_in_trunks\"\ - ,\n \"related\": \"https://sandbox-api.didww.com/v3/voice_in_trunk_groups/837c5764-a6c3-456f-aa37-71fc8f8ca07b/voice_in_trunks\"\ - \n }\n }\n },\n \"meta\": {\n \"trunks_count\"\ - : 4\n }\n },\n {\n \"id\": \"ba7ccbef-82ac-4372-9391-eac90d5c9479\"\ - ,\n \"type\": \"pops\",\n \"attributes\": {\n \"name\": \"\ - DE, FRA\"\n }\n }\n ]\n}" - headers: - Content-Type: - - application/vnd.api+json - status: - code: 200 - message: OK -version: 1 diff --git a/tests/fixtures/voice_in_trunks/update_4.yaml b/tests/fixtures/voice_in_trunks/update_4.yaml deleted file mode 100644 index 12fd67c..0000000 --- a/tests/fixtures/voice_in_trunks/update_4.yaml +++ /dev/null @@ -1,40 +0,0 @@ -interactions: -- request: - body: null - headers: - Accept: - - application/vnd.api+json - Api-Key: - - test-api-key - Content-Type: - - application/vnd.api+json - method: PATCH - uri: https://sandbox-api.didww.com/v3/voice_in_trunks/2021b895-52c9-4f65-990b-e57a1abf858d - response: - body: - string: "{\n \"data\": {\n \"id\": \"2021b895-52c9-4f65-990b-e57a1abf858d\"\ - ,\n \"type\": \"voice_in_trunks\",\n \"attributes\": {\n \"priority\"\ - : 1,\n \"capacity_limit\": null,\n \"weight\": 65535,\n \"\ - name\": \"hello, updated test iax2 trunk\",\n \"cli_format\": \"e164\"\ - ,\n \"cli_prefix\": null,\n \"description\": null,\n \"ringing_timeout\"\ - : null,\n \"configuration\": {\n \"type\": \"iax2_configurations\"\ - ,\n \"attributes\": {\n \"dst\": \"558540420024\",\n \ - \ \"host\": \"example.com\",\n \"port\": 4567,\n \"\ - auth_user\": \"new_auth_user\",\n \"auth_password\": \"new_auth_password\"\ - ,\n \"codec_ids\": [\n 9,\n 10,\n \ - \ 8,\n 7,\n 6\n ]\n }\n },\n\ - \ \"created_at\": \"2018-12-29T10:07:53.374Z\"\n },\n \"relationships\"\ - : {\n \"voice_in_trunk_group\": {\n \"links\": {\n \"\ - self\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/2021b895-52c9-4f65-990b-e57a1abf858d/relationships/voice_in_trunk_group\"\ - ,\n \"related\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/2021b895-52c9-4f65-990b-e57a1abf858d/voice_in_trunk_group\"\ - \n }\n },\n \"pop\": {\n \"links\": {\n \"\ - self\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/2021b895-52c9-4f65-990b-e57a1abf858d/relationships/pop\"\ - ,\n \"related\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/2021b895-52c9-4f65-990b-e57a1abf858d/pop\"\ - \n }\n }\n }\n }\n}" - headers: - Content-Type: - - application/vnd.api+json - status: - code: 200 - message: OK -version: 1 diff --git a/tests/fixtures/voice_in_trunks/update_7.yaml b/tests/fixtures/voice_in_trunks/update_7.yaml deleted file mode 100644 index 0490c83..0000000 --- a/tests/fixtures/voice_in_trunks/update_7.yaml +++ /dev/null @@ -1,38 +0,0 @@ -interactions: -- request: - body: null - headers: - Accept: - - application/vnd.api+json - Api-Key: - - test-api-key - Content-Type: - - application/vnd.api+json - method: PATCH - uri: https://sandbox-api.didww.com/v3/voice_in_trunks/78146511-7648-45ba-9b26-a4b2cf87db06 - response: - body: - string: "{\n \"data\": {\n \"id\": \"78146511-7648-45ba-9b26-a4b2cf87db06\"\ - ,\n \"type\": \"voice_in_trunks\",\n \"attributes\": {\n \"priority\"\ - : 1,\n \"capacity_limit\": null,\n \"weight\": 65535,\n \"\ - name\": \"hello, updated test h323 trunk\",\n \"cli_format\": \"e164\"\ - ,\n \"cli_prefix\": null,\n \"description\": null,\n \"ringing_timeout\"\ - : null,\n \"configuration\": {\n \"type\": \"h323_configurations\"\ - ,\n \"attributes\": {\n \"dst\": \"558540420024\",\n \ - \ \"host\": \"example2.com\",\n \"port\": 4567,\n \"\ - codec_ids\": [\n 9,\n 10,\n 8,\n \ - \ 7,\n 6\n ]\n }\n },\n \"created_at\"\ - : \"2018-12-29T10:20:50.396Z\"\n },\n \"relationships\": {\n \"\ - voice_in_trunk_group\": {\n \"links\": {\n \"self\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/78146511-7648-45ba-9b26-a4b2cf87db06/relationships/voice_in_trunk_group\"\ - ,\n \"related\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/78146511-7648-45ba-9b26-a4b2cf87db06/voice_in_trunk_group\"\ - \n }\n },\n \"pop\": {\n \"links\": {\n \"\ - self\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/78146511-7648-45ba-9b26-a4b2cf87db06/relationships/pop\"\ - ,\n \"related\": \"https://sandbox-api.didww.com/v3/voice_in_trunks/78146511-7648-45ba-9b26-a4b2cf87db06/pop\"\ - \n }\n }\n }\n }\n}" - headers: - Content-Type: - - application/vnd.api+json - status: - code: 200 - message: OK -version: 1 diff --git a/tests/resources/test_voice_in_trunk.py b/tests/resources/test_voice_in_trunk.py index d6e861c..c012881 100644 --- a/tests/resources/test_voice_in_trunk.py +++ b/tests/resources/test_voice_in_trunk.py @@ -13,8 +13,6 @@ from didww.resources.voice_in_trunk import VoiceInTrunk from didww.resources.configuration.pstn import PstnConfiguration from didww.resources.configuration.sip import SipConfiguration -from didww.resources.configuration.h323 import H323Configuration -from didww.resources.configuration.iax2 import Iax2Configuration class TestVoiceInTrunk: @@ -25,13 +23,12 @@ def test_list_voice_in_trunks(self, client): trunks = response.data assert len(trunks) > 0 first = trunks[0] - assert first.id == "9cbadd6f-0665-46bc-b3aa-687d22157808" - assert first.name == "iax2 trunk sample" + assert first.id == "2b4b1fcf-fe6a-4de9-8a58-7df46820ba13" + assert first.name == "sample trunk pstn" assert first.priority == 1 assert first.weight == 65535 assert first.cli_format == CliFormat.E164 - assert first.voice_in_trunk_group is not None - assert first.voice_in_trunk_group.name == "sample trunk group" + assert first.voice_in_trunk_group is None @my_vcr.use_cassette("voice_in_trunks/list.yaml") def test_list_sip_configuration_attributes(self, client): @@ -112,22 +109,6 @@ def test_sip_configuration_serialization(self): assert data["attributes"]["host"] == "example.com" assert data["attributes"]["codec_ids"] == [9, 10, 8] - def test_h323_configuration_serialization(self): - config = H323Configuration() - config.dst = "{CALL_DID}" - config.host = "127.0.0.1" - data = config.to_jsonapi() - assert data["type"] == "h323_configurations" - assert data["attributes"]["dst"] == "{CALL_DID}" - - def test_iax2_configuration_serialization(self): - config = Iax2Configuration() - config.dst = "test" - config.host = "127.0.0.1" - data = config.to_jsonapi() - assert data["type"] == "iax2_configurations" - assert data["attributes"]["dst"] == "test" - def test_configuration_deserialization(self): from didww.resources.configuration.base import TrunkConfiguration