File tree Expand file tree Collapse file tree 5 files changed +26
-8
lines changed Expand file tree Collapse file tree 5 files changed +26
-8
lines changed Original file line number Diff line number Diff line change 1+ .cache
12.DS_Store
23.AppleDouble
34.LSOverride
67.Spotlight-V100
78.Trashes
89
10+ # virtual environment
11+ venv
12+
913/build
1014/dist
1115/MANIFEST
2024test
2125virtualenv
2226.virtualenv
23- .idea
27+ .idea
Original file line number Diff line number Diff line change 11### NEXT (unreleased)
22
3+ ### 3.6.4 2018-04-09
4+
5+ * Update user tests
6+
37### 3.6.3 2018-02-05
48
59* Fix issue with responses that contain an ` api_key ` field (gh-67 )
Original file line number Diff line number Diff line change 1- 3.6.3
1+ 3.6.4
Original file line number Diff line number Diff line change 55
66child_user = easypost .User .create (
77 name = 'Python All-Things-Testing' ,
8- password = 'password1' ,
9- password_confirmation = 'password1' ,
10- phone_number = '7778675309'
8+ phone_number = '555-555-5555'
119)
1210id = child_user .id
1311
Original file line number Diff line number Diff line change 11# Unit tests related to 'Users' (https://www.easypost.com/docs/api#users).
22
33import easypost
4+ import pytest
45
56
67def test_child_user_create (prod_api_key ):
78 # Create an address and then verify some fields to test whether it was created just fine.
89 child_user = easypost .User .create (
9- name = 'Python All-Things-Testing' ,
10- password = 'password1' ,
11- password_confirmation = 'password1' ,
10+ name = 'Python All-Things-Testing'
1211 )
12+
13+ with pytest .raises (easypost .Error ) as caught_exception :
14+ easypost .User .create (
15+ name = 'Python All-Things-Testing' ,
16+ password = 'super-secret-password' ,
17+ password_confirmation = 'super-secret-password'
18+ )
19+
20+ exception = caught_exception .value .json_body
21+ error_msg = 'Child users must be created via the API and must not contain an email or password.'
22+ assert exception ['error' ]['message' ] == error_msg
23+ assert exception ['error' ]['code' ] == 'USER.INVALID'
24+
1325 child_id = child_user .id
1426 assert child_id is not None
1527
You can’t perform that action at this time.
0 commit comments