Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
address comments
  • Loading branch information
Eason Yang committed Sep 29, 2020
commit 5b85221da3984b60e6b679057976d13a106a95a6
Original file line number Diff line number Diff line change
Expand Up @@ -32,78 +32,95 @@ def setUp(self):
PhoneNumberUriReplacer()])
self._phone_number_administration_client = PhoneNumberAdministrationClient.from_connection_string(
self.connection_str)
self.country_code = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_COUNTRY_CODE', "US")
self.locale = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_LOCALE', "en-us")
self.phone_plan_group_id = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONE_PLAN_GROUP_ID', "phone-plan-group-id-1")
self.phone_plan_id = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONE_PLAN_ID', "phone-plan-id-1")
self.phone_plan_id_area_codes = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONE_PLAN_ID_AREA_CODES', "phone-plan-id-1")
self.area_code_for_search = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_AREA_CODE_FOR_SEARCH', "777")
self.search_id = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_SEARCH_ID', "search-id-1")
self.search_id_to_purchase = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_SEARCH_ID_TO_PURCHASE', "search-id-1")
self.search_id_to_cancel = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_SEARCH_ID_TO_CANCEL', "search-id-2")
self.phonenumber_to_configure = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONENUMBER_TO_CONFIGURE', "+17771234567")
self.phonenumber_to_get_config = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONENUMBER_TO_GET_CONFIG', "+17771234567")
self.phonenumber_to_unconfigure = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONENUMBER_TO_UNCONFIGURE', "+17771234567")
self.phonenumber_for_capabilities = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_PHONENUMBER_FOR_CAPABILITIES', "+17771234567")
self.capabilities_id = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_CAPABILITIES_ID', "capabilities-id-1")
self.release_id = os.getenv('AZURE_COMMUNICATION_SERVICE_TNM_RELEASE_ID', "release_id_1")
self.scrubber.register_name_pair(
self.phone_plan_group_id,
"phone_plan_group_id"
)
self.scrubber.register_name_pair(
self.phone_plan_id,
"phone_plan_id"
)
self.scrubber.register_name_pair(
self.phone_plan_id_area_codes,
"phone_plan_id_area_codes"
)
self.scrubber.register_name_pair(
self.area_code_for_search,
"area_code_for_search"
)
self.scrubber.register_name_pair(
self.search_id,
"search_id"
)
self.scrubber.register_name_pair(
self.search_id_to_purchase,
"search_id_to_purchase"
)
self.scrubber.register_name_pair(
self.search_id_to_cancel,
"search_id_to_cancel"
)
self.scrubber.register_name_pair(
self.phonenumber_to_configure,
"phonenumber_to_configure"
)
self.scrubber.register_name_pair(
self.phonenumber_to_get_config,
"phonenumber_to_get_config"
)
self.scrubber.register_name_pair(
self.phonenumber_to_unconfigure,
"phonenumber_to_unconfigure"
)
self.scrubber.register_name_pair(
self.phonenumber_for_capabilities,
"phonenumber_for_capabilities"
)
self.scrubber.register_name_pair(
self.capabilities_id,
"capabilities_id"
)
self.scrubber.register_name_pair(
self.release_id,
"release_id"
)
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.scrubber.register_name_pair(
self.phone_plan_group_id,
"phone_plan_group_id"
)
self.scrubber.register_name_pair(
self.phone_plan_id,
"phone_plan_id"
)
self.scrubber.register_name_pair(
self.phone_plan_id_area_codes,
"phone_plan_id_area_codes"
)
self.scrubber.register_name_pair(
self.area_code_for_search,
"area_code_for_search"
)
self.scrubber.register_name_pair(
self.search_id,
"search_id"
)
self.scrubber.register_name_pair(
self.search_id_to_purchase,
"search_id_to_purchase"
)
self.scrubber.register_name_pair(
self.search_id_to_cancel,
"search_id_to_cancel"
)
self.scrubber.register_name_pair(
self.phonenumber_to_configure,
"phonenumber_to_configure"
)
self.scrubber.register_name_pair(
self.phonenumber_to_get_config,
"phonenumber_to_get_config"
)
self.scrubber.register_name_pair(
self.phonenumber_to_unconfigure,
"phonenumber_to_unconfigure"
)
self.scrubber.register_name_pair(
self.phonenumber_for_capabilities,
"phonenumber_for_capabilities"
)
self.scrubber.register_name_pair(
self.capabilities_id,
"capabilities_id"
)
self.scrubber.register_name_pair(
self.release_id,
"release_id"
)
else:
self.country_code = "US"
self.locale = "en-us"
self.phone_plan_group_id = "phone-plan-group-id-1"
self.phone_plan_id = "phone-plan-id-1"
self.phone_plan_id_area_codes = "phone-plan-id-1"
self.area_code_for_search = "777"
self.search_id = "search-id-1"
self.search_id_to_purchase = "search-id-1"
self.search_id_to_cancel = "search-id-2"
self.phonenumber_to_configure = "+17771234567"
self.phonenumber_to_get_config = "+17771234567"
self.phonenumber_to_unconfigure = "+17771234567"
self.phonenumber_for_capabilities = "+17771234567"
self.capabilities_id = "capabilities-id-1"
self.release_id = "release_id_1"

@pytest.mark.live_test_only
def test_list_all_phone_numbers(self):
pages = self._phone_number_administration_client.list_all_phone_numbers()
assert pages.next() is not None
assert pages.next()

@pytest.mark.live_test_only
def test_get_all_area_codes(self):
Expand All @@ -112,14 +129,14 @@ def test_get_all_area_codes(self):
country_code=self.country_code,
phone_plan_id=self.phone_plan_id_area_codes
)
assert area_codes.primary_area_codes is not None
assert area_codes.primary_area_codes

@pytest.mark.live_test_only
def test_get_capabilities_update(self):
capability_response = self._phone_number_administration_client.get_capabilities_update(
capabilities_update_id=self.capabilities_id
)
assert capability_response.capabilities_update_id is not None
assert capability_response.capabilities_update_id

@pytest.mark.live_test_only
def test_update_capabilities(self):
Expand All @@ -132,19 +149,19 @@ def test_update_capabilities(self):
capability_response = self._phone_number_administration_client.update_capabilities(
phone_number_capabilities_update=phone_number_capabilities_update
)
assert capability_response.capabilities_update_id is not None
assert capability_response.capabilities_update_id

@pytest.mark.live_test_only
def test_list_all_supported_countries(self):
countries = self._phone_number_administration_client.list_all_supported_countries()
assert countries.next().localized_name is not None
assert countries.next().localized_name

@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
)
assert phone_number_response.pstn_configuration is not None
assert phone_number_response.pstn_configuration

@pytest.mark.live_test_only
def test_configure_number(self):
Expand All @@ -163,15 +180,15 @@ def test_list_phone_plan_groups(self):
phone_plan_group_response = self._phone_number_administration_client.list_phone_plan_groups(
country_code=self.country_code
)
assert phone_plan_group_response.next().phone_plan_group_id is not None
assert phone_plan_group_response.next().phone_plan_group_id

@pytest.mark.live_test_only
def test_list_phone_plans(self):
phone_plan_response = self._phone_number_administration_client.list_phone_plans(
country_code=self.country_code,
phone_plan_group_id=self.phone_plan_group_id
)
assert phone_plan_response.next().phone_plan_id is not None
assert phone_plan_response.next().phone_plan_id

@pytest.mark.live_test_only
def test_get_phone_plan_location_options(self):
Expand All @@ -180,26 +197,26 @@ def test_get_phone_plan_location_options(self):
phone_plan_group_id=self.phone_plan_group_id,
phone_plan_id=self.phone_plan_id
)
assert location_options_response.location_options.label_id is not None
assert location_options_response.location_options.label_id

@pytest.mark.live_test_only
def test_get_release_by_id(self):
phone_number_release_response = self._phone_number_administration_client.get_release_by_id(
release_id=self.release_id
)
assert phone_number_release_response.release_id is not None
assert phone_number_release_response.release_id

@pytest.mark.live_test_only
def test_list_all_releases(self):
releases_response = self._phone_number_administration_client.list_all_releases()
assert releases_response.next().id is not None
assert releases_response.next().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(
search_id=self.search_id
)
assert phone_number_search_response.search_id is not None
assert phone_number_search_response.search_id

@pytest.mark.live_test_only
def test_create_search(self):
Expand All @@ -213,7 +230,7 @@ def test_create_search(self):
search_response = self._phone_number_administration_client.create_search(
body=searchOptions
)
assert search_response.search_id is not None
assert search_response.search_id

@pytest.mark.live_test_only
def test_cancel_search(self):
Expand Down
Loading