File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,10 +53,10 @@ Run tests:
5353python -m nose
5454```
5555
56- Run a single test:
56+ Run a single test without swallowing print :
5757
5858``` sh
59- python -m nose tests/test_engine.py:test_lean_engine_error
59+ python -m nose -v --nocapture tests/test_engine.py:test_lean_engine_error
6060```
6161
6262## Linter and Formatter
Original file line number Diff line number Diff line change @@ -38,25 +38,30 @@ def test_basic_push(): # type: () -> None
3838 "launch-image" : "" ,
3939 }
4040 }
41- query = leancloud .Query ("_Installation" ).equal_to ("objectId " , "xxx" )
41+ query = leancloud .Query ("_Installation" ).equal_to ("deviceToken " , "xxx" )
4242 now = datetime .now ()
4343 two_hours_later = now + timedelta (hours = 2 )
44- notification = push .send (
45- data ,
46- where = query ,
47- push_time = now ,
48- expiration_time = two_hours_later ,
49- prod = "dev" ,
50- flow_control = 0 ,
51- )
52- # flow_control = 0 <=> flow_control = 1000 by rest api design
53- time .sleep (5 ) # notification write may have delay
54- notification .fetch ()
55- assert notification .id
56-
5744 try :
58- notification .save ()
45+ notification = push .send (
46+ data ,
47+ where = query ,
48+ push_time = now ,
49+ expiration_time = two_hours_later ,
50+ prod = "dev" ,
51+ flow_control = 0 ,
52+ )
5953 except leancloud .LeanCloudError as e :
54+ # LeanCloudError: [1] The iOS certificate file is expired or disabled.
6055 assert e .code == 1
6156 else :
62- raise Exception ()
57+ # flow_control = 0 <=> flow_control = 1000 by rest api design
58+ time .sleep (5 ) # notification write may have delay
59+ notification .fetch ()
60+ assert notification .id
61+ # Test that notification is read only.
62+ try :
63+ notification .save ()
64+ except leancloud .LeanCloudError as e :
65+ assert e .code == 1
66+ else :
67+ raise Exception ()
Original file line number Diff line number Diff line change @@ -284,7 +284,7 @@ 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 ):
287+ if e .code not in (119 , 213 , 601 , 605 ):
288288 raise e
289289 finally :
290290 user1 .logout ()
You can’t perform that action at this time.
0 commit comments