-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
SNS: v2 add http endpoint for opting out phone numbers #13540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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