SNS: v2 add http endpoint for opting out phone numbers#13540
Conversation
Test Results - Alternative Providers210 tests 166 ✅ 2m 7s ⏱️ Results for commit a94e85a. ♻️ This comment has been updated with latest results. |
Test Results (amd64) - Integration, Bootstrap 5 files 5 suites 1h 30m 28s ⏱️ Results for commit a94e85a. ♻️ This comment has been updated with latest results. |
LocalStack Community integration with Pro 2 files ± 0 2 suites ±0 1h 5m 0s ⏱️ - 51m 34s Results for commit a94e85a. ± Comparison against base commit 0832e59. This pull request removes 2032 and adds 1 tests. Note that renamed tests count towards both.This pull request removes 224 skipped tests and adds 1 skipped test. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
bentsku
left a comment
There was a problem hiding this comment.
Awesome, nice addition! Just a minor comment regarding marking the test as not runnable in a different process, but then we're good to go 🚀
| TAGS: TaggingService = CrossRegionAttribute(default=TaggingService) | ||
|
|
||
| PHONE_NUMBERS_OPTED_OUT: list[PhoneNumber] = CrossRegionAttribute(default=list) | ||
| PHONE_NUMBERS_OPTED_OUT: set[PhoneNumber] = CrossRegionAttribute(default=set) |
There was a problem hiding this comment.
quick followup question from the previous PR: should we put this back as lower case to follow the rest of the attributes?
There was a problem hiding this comment.
I was under the impression that local attributes are lower case, while cross region attributes like TAGS are all uppercase. Since this is per account, I uppercased it. Wrong approach?
There was a problem hiding this comment.
Good question, the only one I know that was using the uppercase was the TAGS and wasn't aware of any others. I'm not sure why tags got uppercased actually 😄 but I'd suggest to use lowercase as to me uppercase in Python is synonym with constants. If it is actually a convention then we can leave it. It's a nit anyway, we can leave it like that too 👍
tests/aws/services/sns/test_sns.py
Outdated
| response = aws_client.sns.check_if_phone_number_is_opted_out(phoneNumber=phone_number) | ||
| assert not response["isOptedOut"] | ||
| data = {"phoneNumber": phone_number, "accountId": account_id} | ||
| requests.post("http://localhost:4566/_aws/sns/phone-opt-outs", data=json.dumps(data)) |
There was a problem hiding this comment.
nit: might be worth switch this to phone_url = config.external_service_url() + SMS_PHONE_NUMBER_OPT_OUT_ENDPOINT like the other tests.
Also worth saying that the other endpoint tests are using internal_service_url, so those won't work in the k8s environment, so it might be worth marking this test as @markers.requires_in_process for now until we can validate they would work 👍
b306086 to
a94e85a
Compare
bentsku
left a comment
There was a problem hiding this comment.
LGTM! Thanks for addressing the comments 👍
Motivation
In AWS, you can opt-out phone numbers so they are not included in sms push notifications. This opt-out is usually done via keyword response (STOP and similar words) to the sms message, or can be done in AWS Console in a Service called Pinpoint.
This PR therefore implements a simple endpoint to allow users opting-out phone numbers for the sake testing and using SNS' opted-out operations.
closes PNX-549
ref DOC-26
Changes
/_aws/sns/phone-opt-outsas POST endpoint to SNSTests
Related