diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_release_phone_numbers.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_release_phone_numbers.yaml new file mode 100644 index 000000000000..6523c0d0d697 --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client.test_release_phone_numbers.yaml @@ -0,0 +1,39 @@ +interactions: +- request: + body: '{"phoneNumbers": "sanitized"}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '34' + Content-Type: + - application/json + Date: + - Fri, 02 Oct 2020 22:26:28 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b2 Python/3.8.5 (Windows-10-10.0.19041-SP0) + x-ms-return-client-request-id: + - 'true' + method: POST + uri: https://sanitized.communication.azure.com/administration/phonenumbers/releases?api-version=2020-07-20-preview1 + response: + body: '{"releaseId": "sanitized"}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Fri, 02 Oct 2020 22:26:27 GMT + ms-cv: + - NlxnpgC8uU2r3FctCKo4VA.0 + transfer-encoding: + - chunked + x-processing-time: + - 735ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_release_phone_numbers.yaml b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_release_phone_numbers.yaml new file mode 100644 index 000000000000..555ece0bf35d --- /dev/null +++ b/sdk/communication/azure-communication-administration/tests/recordings/test_phone_number_administration_client_async.test_release_phone_numbers.yaml @@ -0,0 +1,31 @@ +interactions: +- request: + body: '{"phoneNumbers": "sanitized"}' + headers: + Accept: + - application/json + Content-Length: + - '34' + Content-Type: + - application/json + Date: + - Fri, 02 Oct 2020 22:24:33 GMT + User-Agent: + - azsdk-python-communication-administration/1.0.0b2 Python/3.8.5 (Windows-10-10.0.19041-SP0) + x-ms-return-client-request-id: + - 'true' + method: POST + uri: https://sanitized.communication.azure.com/administration/phonenumbers/releases?api-version=2020-07-20-preview1 + response: + body: '{"releaseId": "sanitized"}' + headers: + content-type: application/json; charset=utf-8 + date: Fri, 02 Oct 2020 22:24:32 GMT + ms-cv: m6zSFyuKqkaYNOWKqeSZRg.0 + transfer-encoding: chunked + x-processing-time: 606ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/administration/phonenumbers/releases?api-version=2020-07-20-preview1 +version: 1 diff --git a/sdk/communication/azure-communication-administration/tests/test_phone_number_administration_client.py b/sdk/communication/azure-communication-administration/tests/test_phone_number_administration_client.py index 90b6b50f35ec..2f09606584ae 100644 --- a/sdk/communication/azure-communication-administration/tests/test_phone_number_administration_client.py +++ b/sdk/communication/azure-communication-administration/tests/test_phone_number_administration_client.py @@ -33,21 +33,22 @@ def setUp(self): self._phone_number_administration_client = PhoneNumberAdministrationClient.from_connection_string( self.connection_str) if self.is_live: - self.country_code = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_COUNTRY_CODE') - self.locale = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_LOCALE') - self.phone_plan_group_id = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONE_PLAN_GROUP_ID') - self.phone_plan_id = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONE_PLAN_ID') - self.phone_plan_id_area_codes = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONE_PLAN_ID_AREA_CODES') - self.area_code_for_search = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_AREA_CODE_FOR_SEARCH') - self.search_id = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_SEARCH_ID') - self.search_id_to_purchase = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_SEARCH_ID_TO_PURCHASE') - self.search_id_to_cancel = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_SEARCH_ID_TO_CANCEL') - self.phonenumber_to_configure = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONENUMBER_TO_CONFIGURE') - self.phonenumber_to_get_config = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONENUMBER_TO_GET_CONFIG') - self.phonenumber_to_unconfigure = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONENUMBER_TO_UNCONFIGURE') - self.phonenumber_for_capabilities = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONENUMBER_FOR_CAPABILITIES') - self.capabilities_id = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_CAPABILITIES_ID') - self.release_id = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_RELEASE_ID') + self.country_code = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_COUNTRY_CODE') + self.locale = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_LOCALE') + self.phone_plan_group_id = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_PHONE_PLAN_GROUP_ID') + self.phone_plan_id = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_PHONE_PLAN_ID') + self.phone_plan_id_area_codes = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_PHONE_PLAN_ID_AREA_CODES') + self.area_code_for_search = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_AREA_CODE_FOR_SEARCH') + self.search_id = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_SEARCH_ID') + self.search_id_to_purchase = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_SEARCH_ID_TO_PURCHASE') + self.search_id_to_cancel = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_SEARCH_ID_TO_CANCEL') + self.phonenumber_to_configure = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_PHONENUMBER_TO_CONFIGURE') + self.phonenumber_to_get_config = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_PHONENUMBER_TO_GET_CONFIG') + self.phonenumber_to_unconfigure = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_PHONENUMBER_TO_UNCONFIGURE') + self.phonenumber_for_capabilities = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_PHONENUMBER_FOR_CAPABILITIES') + self.phonenumber_to_release = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_PHONENUMBER_TO_RELEASE') + self.capabilities_id = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_CAPABILITIES_ID') + self.release_id = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_RELEASE_ID') self.scrubber.register_name_pair( self.phone_plan_group_id, "phone_plan_group_id" @@ -92,6 +93,10 @@ def setUp(self): self.phonenumber_for_capabilities, "phonenumber_for_capabilities" ) + self.scrubber.register_name_pair( + self.phonenumber_to_release, + "phonenumber_to_release" + ) self.scrubber.register_name_pair( self.capabilities_id, "capabilities_id" @@ -115,6 +120,7 @@ def setUp(self): self.phonenumber_to_get_config = "phonenumber_to_get_config" self.phonenumber_to_unconfigure = "phonenumber_to_unconfigure" self.phonenumber_for_capabilities = "phonenumber_for_capabilities" + self.phonenumber_to_release = "phonenumber_to_release" self.capabilities_id = "capabilities_id" self.release_id = "release_id" @@ -160,7 +166,7 @@ def test_list_all_supported_countries(self): @pytest.mark.live_test_only def test_get_number_configuration(self): phone_number_response = self._phone_number_administration_client.get_number_configuration( - phone_number=self.phonenumber_to_unconfigure + phone_number=self.phonenumber_to_get_config ) assert phone_number_response.pstn_configuration @@ -168,12 +174,11 @@ def test_get_number_configuration(self): def test_configure_number(self): pstnConfig = PstnConfiguration( callback_url="https://callbackurl", - application_id="ApplicationId", - azure_pstn_target_id="AzurePstnTargetId" + application_id="ApplicationId" ) configure_number_response = self._phone_number_administration_client.configure_number( pstn_configuration=pstnConfig, - phone_number=self.phonenumber_to_unconfigure + phone_number=self.phonenumber_to_configure ) assert not configure_number_response @@ -213,6 +218,13 @@ def test_list_all_releases(self): releases_response = self._phone_number_administration_client.list_all_releases() assert releases_response.next().id + @pytest.mark.live_test_only + def test_release_phone_numbers(self): + releases_response = self._phone_number_administration_client.release_phone_numbers( + [self.phonenumber_to_release] + ) + assert releases_response.release_id + @pytest.mark.live_test_only def test_get_search_by_id(self): phone_number_search_response = self._phone_number_administration_client.get_search_by_id( diff --git a/sdk/communication/azure-communication-administration/tests/test_phone_number_administration_client_async.py b/sdk/communication/azure-communication-administration/tests/test_phone_number_administration_client_async.py index 178515f52e04..f831124390d0 100644 --- a/sdk/communication/azure-communication-administration/tests/test_phone_number_administration_client_async.py +++ b/sdk/communication/azure-communication-administration/tests/test_phone_number_administration_client_async.py @@ -34,21 +34,22 @@ def setUp(self): self._phone_number_administration_client = PhoneNumberAdministrationClient.from_connection_string( self.connection_str) if self.is_live: - self.country_code = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_COUNTRY_CODE') - self.locale = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_LOCALE') - self.phone_plan_group_id = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONE_PLAN_GROUP_ID') - self.phone_plan_id = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONE_PLAN_ID') - self.phone_plan_id_area_codes = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONE_PLAN_ID_AREA_CODES') - self.area_code_for_search = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_AREA_CODE_FOR_SEARCH') - self.search_id = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_SEARCH_ID') - self.search_id_to_purchase = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_SEARCH_ID_TO_PURCHASE') - self.search_id_to_cancel = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_SEARCH_ID_TO_CANCEL') - self.phonenumber_to_configure = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONENUMBER_TO_CONFIGURE') - self.phonenumber_to_get_config = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONENUMBER_TO_GET_CONFIG') - self.phonenumber_to_unconfigure = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONENUMBER_TO_UNCONFIGURE') - self.phonenumber_for_capabilities = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONENUMBER_FOR_CAPABILITIES') - self.capabilities_id = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_CAPABILITIES_ID') - self.release_id = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_RELEASE_ID') + self.country_code = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_COUNTRY_CODE') + self.locale = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_LOCALE') + self.phone_plan_group_id = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_PHONE_PLAN_GROUP_ID') + self.phone_plan_id = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_PHONE_PLAN_ID') + self.phone_plan_id_area_codes = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_PHONE_PLAN_ID_AREA_CODES') + self.area_code_for_search = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_AREA_CODE_FOR_SEARCH') + self.search_id = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_SEARCH_ID') + self.search_id_to_purchase = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_SEARCH_ID_TO_PURCHASE') + self.search_id_to_cancel = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_SEARCH_ID_TO_CANCEL') + self.phonenumber_to_configure = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_PHONENUMBER_TO_CONFIGURE') + self.phonenumber_to_get_config = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_PHONENUMBER_TO_GET_CONFIG') + self.phonenumber_to_unconfigure = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_PHONENUMBER_TO_UNCONFIGURE') + self.phonenumber_for_capabilities = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_PHONENUMBER_FOR_CAPABILITIES') + self.phonenumber_to_release = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_PHONENUMBER_TO_RELEASE') + self.capabilities_id = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_CAPABILITIES_ID') + self.release_id = os.getenv('AZURE_COMMUNICATION_SERVICE_PHONENUMBERS_RELEASE_ID') self.scrubber.register_name_pair( self.phone_plan_group_id, "phone_plan_group_id" @@ -93,6 +94,10 @@ def setUp(self): self.phonenumber_for_capabilities, "phonenumber_for_capabilities" ) + self.scrubber.register_name_pair( + self.phonenumber_to_release, + "phonenumber_to_release" + ) self.scrubber.register_name_pair( self.capabilities_id, "capabilities_id" @@ -116,6 +121,7 @@ def setUp(self): self.phonenumber_to_get_config = "phonenumber_to_get_config" self.phonenumber_to_unconfigure = "phonenumber_to_unconfigure" self.phonenumber_for_capabilities = "phonenumber_for_capabilities" + self.phonenumber_to_release = "phonenumber_to_release" self.capabilities_id = "capabilities_id" self.release_id = "release_id" @@ -190,8 +196,7 @@ async def test_get_number_configuration(self): async def test_configure_number(self): pstnConfig = PstnConfiguration( callback_url="https://callbackurl", - application_id="ApplicationId", - azure_pstn_target_id="AzurePstnTargetId" + application_id="ApplicationId" ) async with self._phone_number_administration_client: configure_number_response = await self._phone_number_administration_client.configure_number( @@ -261,6 +266,15 @@ async def test_list_all_releases(self): self.assertGreater(len(items), 0) assert items[0].id + @AsyncCommunicationTestCase.await_prepared_test + @pytest.mark.live_test_only + async def test_release_phone_numbers(self): + async with self._phone_number_administration_client: + releases_response = await self._phone_number_administration_client.release_phone_numbers( + [self.phonenumber_to_release] + ) + assert releases_response.release_id + @AsyncCommunicationTestCase.await_prepared_test @pytest.mark.live_test_only async def test_get_search_by_id(self):