Skip to content

Commit

Permalink
added successful test recording
Browse files Browse the repository at this point in the history
  • Loading branch information
jorge-beauregard committed Jan 28, 2021
1 parent d8836a4 commit aa29772
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def __init__(
self._endpoint = endpoint
self._phone_number_administration_client = PhoneNumberAdministrationClientGen(
self._endpoint,
authentication_policy=get_authentication_policy(endpoint, credential),
authentication_policy=get_authentication_policy(endpoint, credential, is_async=True),
sdk_moniker=SDK_MONIKER,
**kwargs)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
interactions:
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
User-Agent:
- azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
method: GET
uri: https://sanitized.communication.azure.com/administration/phonenumbers/phonenumbers?locale=en-US&skip=0&take=100&api-version=2020-07-20-preview1
response:
body:
string: '{"phoneNumbers": "sanitized", "nextLink": null}'
headers:
content-type:
- application/json; charset=utf-8
date:
- Tue, 26 Jan 2021 18:56:12 GMT
ms-cv:
- fqvIVn7QTU2rhudQ0Xygaw.0
request-context:
- appId=
transfer-encoding:
- chunked
x-processing-time:
- 824ms
status:
code: 200
message: OK
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
interactions:
- request:
body: null
headers:
Accept:
- application/json
User-Agent:
- azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0)
method: GET
uri: https://sanitized.communication.azure.com/administration/phonenumbers/phonenumbers?locale=en-US&skip=0&take=100&api-version=2020-07-20-preview1
response:
body:
string: '{"phoneNumbers": "sanitized", "nextLink": null}'
headers:
content-type: application/json; charset=utf-8
date: Tue, 26 Jan 2021 19:56:21 GMT
ms-cv: zqvTNGtq40i4vqZgCLIwLQ.0
request-context: appId=
transfer-encoding: chunked
x-processing-time: 1732ms
status:
code: 200
message: OK
url: https://sanitized.communication.azure.com/administration/phonenumbers/phonenumbers?locale=en-US&skip=0&take=100&api-version=2020-07-20-preview1
version: 1
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,16 @@ def setUp(self):

@pytest.mark.live_test_only
@pytest.mark.skipif(SKIP_PHONE_NUMBER_TESTS, reason=PHONE_NUMBER_TEST_SKIP_REASON)
def test_list_all_phone_numbers_from_managed_identity(self, connection_string):
endpoint, access_key = parse_connection_str(connection_string)
def test_list_all_phone_numbers_from_managed_identity(self):
endpoint, access_key = parse_connection_str(self.connection_str)
from devtools_testutils import is_live
if not is_live():
credential = FakeTokenCredential()
else:
credential = DefaultAzureCredential()
phone_number_client = PhoneNumberAdministrationClient(endpoint, credential)
user = identity_client.create_user()

assert user.identifier is not None
pages = phone_number_client.list_all_phone_numbers()
assert pages.next()

@pytest.mark.live_test_only
@pytest.mark.skipif(SKIP_PHONE_NUMBER_TESTS, reason=PHONE_NUMBER_TEST_SKIP_REASON)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,20 @@ def setUp(self):
@AsyncPhoneNumberCommunicationTestCase.await_prepared_test
@pytest.mark.live_test_only
@pytest.mark.skipif(SKIP_PHONE_NUMBER_TESTS, reason=PHONE_NUMBER_TEST_SKIP_REASON)
async def test_create_user_from_managed_identity(self, connection_string):
endpoint, access_key = parse_connection_str(connection_string)
async def test_list_all_phone_numbers_from_managed_identity(self):
endpoint, access_key = parse_connection_str(self.connection_str)
from devtools_testutils import is_live
if not is_live():
credential = FakeTokenCredential()
else:
credential = DefaultAzureCredential()
identity_client = CommunicationIdentityClient(endpoint, credential)
async with identity_client:
user = await identity_client.create_user()

assert user.identifier is not None
phone_number_client = PhoneNumberAdministrationClient(endpoint, credential)
async with phone_number_client:
pages = phone_number_client.list_all_phone_numbers()
items = []
async for item in pages:
items.append(item)
assert len(items) > 0

@AsyncPhoneNumberCommunicationTestCase.await_prepared_test
@pytest.mark.live_test_only
Expand Down

0 comments on commit aa29772

Please sign in to comment.