Skip to content

Commit

Permalink
Fix python sms live test failures (#16385)
Browse files Browse the repository at this point in the history
* Fix sms client to adapt new phone number model

* Fix async test

Co-authored-by: turalf <[email protected]>
  • Loading branch information
turalf and turalf authored Jan 28, 2021
1 parent db4ca2e commit e354a95
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ def send(self, from_phone_number, # type: ~azure.communication.sms.PhoneNumberId
send_sms_options = kwargs.pop('send_sms_options', None)

request = SendMessageRequest(
from_property=from_phone_number,
to=to_phone_numbers,
from_property=from_phone_number.phone_number,
to=[p.phone_number for p in to_phone_numbers],
message=message,
send_sms_options=send_sms_options,
**kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(
"invalid credential from connection string.")

self._endpoint = endpoint
self._authentication_policy = get_authentication_policy(endpoint, credential)
self._authentication_policy = get_authentication_policy(endpoint, credential, is_async=True)

self._sms_service_client = AzureCommunicationSMSService(
self._endpoint,
Expand Down Expand Up @@ -94,8 +94,8 @@ async def send(self, from_phone_number, # type: ~azure.communication.sms.PhoneN
send_sms_options = kwargs.pop('send_sms_options', None)

request = SendMessageRequest(
from_property=from_phone_number,
to=to_phone_numbers,
from_property=from_phone_number.phone_number,
to=[p.phone_number for p in to_phone_numbers],
message=message,
send_sms_options=send_sms_options,
**kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ async def test_send_sms_async_from_managed_identity(self):
async with sms_client:
# calling send() with sms values
sms_response = await sms_client.send(
from_phone_number=PhoneNumber(self.phone_number),
to_phone_numbers=[PhoneNumber(self.phone_number)],
from_phone_number=PhoneNumberIdentifier(self.phone_number),
to_phone_numbers=[PhoneNumberIdentifier(self.phone_number)],
message="Hello World via SMS",
send_sms_options=SendSmsOptions(enable_delivery_report=True)) # optional property

Expand Down

0 comments on commit e354a95

Please sign in to comment.