Skip to content

Commit 17f8125

Browse files
committed
test: catch sms limit error
1 parent 3070c5e commit 17f8125

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

.github/workflows/pythonpackage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
strategy:
4444
max-parallel: 1
4545
matrix:
46-
python-version: [3.5, 3.8, 3.9]
46+
python-version: [3.5, 3.9, 3.12]
4747
steps:
4848
- uses: actions/checkout@v2
4949
- name: Set up Python

tests/test_engine.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,10 @@ def test_request_sms_code(): # type: () -> None
579579
pass
580580
elif e.code == 601 or e.error.startswith("SMS request too fast"): # send sms too frequently
581581
pass
582+
elif e.error.startswith("SMS sending exceeds limit"):
583+
pass
584+
elif "send too frequently" in e.error:
585+
pass
582586
else:
583587
raise e
584588

tests/test_user.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,13 @@ def test_request_change_phone_number(): # type: () -> None
284284
# phone number is from http://www.z-sms.com
285285
User.request_change_phone_number("+8617180655340")
286286
except LeanCloudError as e:
287-
if e.code not in (119, 213, 601, 605):
287+
if e.code in (119, 213, 601, 605):
288+
pass
289+
elif e.error.startswith("SMS sending exceeds limit"):
290+
pass
291+
elif "send too frequently" in e.error:
292+
pass
293+
else:
288294
raise e
289295
finally:
290296
user1.logout()

0 commit comments

Comments
 (0)