Skip to content

Commit 847e34d

Browse files
committed
work in more review suggestions
1 parent a3a8ad3 commit 847e34d

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

localstack-core/localstack/services/sns/v2/provider.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -639,12 +639,12 @@ def _validate_sms_attributes(attributes: dict) -> None:
639639
for k, v in attributes.items():
640640
if k not in SMS_ATTRIBUTE_NAMES:
641641
raise InvalidParameterException(f"{k} is not a valid attribute")
642-
default_send_id = attributes.get("DefaultSendID")
643-
if default_send_id and not re.match(SMS_DEFAULT_SENDER_REGEX, default_send_id):
644-
raise InvalidParameterException(f"{k} is not a valid attribute")
645-
sms_type = attributes.get("DefaultSMSType")
646-
if sms_type and sms_type not in SMS_TYPES:
647-
raise InvalidParameterException("DefaultSMSType is invalid")
642+
default_send_id = attributes.get("DefaultSendID")
643+
if default_send_id and not re.match(SMS_DEFAULT_SENDER_REGEX, default_send_id):
644+
raise InvalidParameterException("DefaultSendID is not a valid attribute")
645+
sms_type = attributes.get("DefaultSMSType")
646+
if sms_type and sms_type not in SMS_TYPES:
647+
raise InvalidParameterException("DefaultSMSType is invalid")
648648

649649

650650
def _set_sms_attribute_default(store: SnsStore) -> None:

tests/aws/services/sns/test_sns.validation.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -75,39 +75,39 @@
7575
}
7676
},
7777
"tests/aws/services/sns/test_sns.py::TestSNSSMS::test_set_invalid_sms_attributes[InvalidAttributeName]": {
78-
"last_validated_date": "2025-10-13T10:43:41+00:00",
78+
"last_validated_date": "2025-10-15T12:14:04+00:00",
7979
"durations_in_seconds": {
80-
"setup": 0.95,
81-
"call": 0.71,
82-
"teardown": 0.06,
83-
"total": 1.72
80+
"setup": 1.45,
81+
"call": 1.32,
82+
"teardown": 0.0,
83+
"total": 2.77
8484
}
8585
},
8686
"tests/aws/services/sns/test_sns.py::TestSNSSMS::test_set_invalid_sms_attributes[InvalidSMSType]": {
87-
"last_validated_date": "2025-10-13T10:43:57+00:00",
87+
"last_validated_date": "2025-10-15T12:14:12+00:00",
8888
"durations_in_seconds": {
8989
"setup": 0.0,
90-
"call": 4.86,
91-
"teardown": 0.01,
92-
"total": 4.87
90+
"call": 2.24,
91+
"teardown": 0.0,
92+
"total": 2.24
9393
}
9494
},
9595
"tests/aws/services/sns/test_sns.py::TestSNSSMS::test_set_invalid_sms_attributes[NoLetterID]": {
96-
"last_validated_date": "2025-10-13T10:43:52+00:00",
96+
"last_validated_date": "2025-10-15T12:14:09+00:00",
9797
"durations_in_seconds": {
98-
"setup": 0.0,
99-
"call": 6.68,
100-
"teardown": 0.01,
101-
"total": 6.69
98+
"setup": 0.01,
99+
"call": 3.39,
100+
"teardown": 0.0,
101+
"total": 3.4
102102
}
103103
},
104104
"tests/aws/services/sns/test_sns.py::TestSNSSMS::test_set_invalid_sms_attributes[TooLongID]": {
105-
"last_validated_date": "2025-10-13T10:43:45+00:00",
105+
"last_validated_date": "2025-10-15T12:14:06+00:00",
106106
"durations_in_seconds": {
107-
"setup": 0.0,
108-
"call": 3.58,
109-
"teardown": 0.01,
110-
"total": 3.59
107+
"setup": 0.1,
108+
"call": 1.78,
109+
"teardown": 0.0,
110+
"total": 1.88
111111
}
112112
},
113113
"tests/aws/services/sns/test_sns.py::TestSNSSMS::test_set_invalid_sms_attributes[attribute_key_value0]": {

0 commit comments

Comments
 (0)