File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -11,12 +11,10 @@ def test_read_all_has_kent():
11
11
# We use requests.get() with url to make a get request
12
12
response = requests .get (BASE_URI )
13
13
# response from requests has many useful properties
14
+ # we can assert on the response status code
15
+ assert_that (response .status_code ).is_equal_to (requests .codes .ok )
14
16
# We can get python dict as response by using .json() method
15
17
response_text = response .json ()
16
- pretty_print (response_text )
17
-
18
- # Also we can assert on the response status code
19
- assert_that (response .status_code ).is_equal_to (200 )
20
18
first_names = [people ['fname' ] for people in response_text ]
21
19
assert_that (first_names ).contains ('Kent' )
22
20
@@ -39,7 +37,7 @@ def test_new_person_can_be_added():
39
37
40
38
# We use requests.post method with keyword params to make the request more readable
41
39
response = requests .post (url = BASE_URI , data = payload , headers = headers )
42
- assert_that (response .status_code ).is_equal_to (204 )
40
+ assert_that (response .status_code ).is_equal_to (requests . codes . no_content )
43
41
44
42
# After user is created, we read all the users and then use filter expression to find if the
45
43
# created user is present in the response list
You can’t perform that action at this time.
0 commit comments