Skip to content

Commit 2ca9964

Browse files
author
Gaurav Singh
committed
Replaced get methods assetions with assertpy's fluent assertion
1 parent 3f9fc63 commit 2ca9964

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/people_test.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ def test_read_all_has_kent():
1414
# we can assert on the response status code
1515
assert_that(response.status_code).is_equal_to(requests.codes.ok)
1616
# We can get python dict as response by using .json() method
17-
response_text = response.json()
18-
first_names = [people['fname'] for people in response_text]
19-
assert_that(first_names).contains('Kent')
17+
response_content = response.json()
18+
19+
# Use assertpy's fluent assertions to extract all fnames and then see the result is non empty and has
20+
# Kent in it.
21+
assert_that(response_content).extracting('fname').is_not_empty().contains('Kent')
2022

2123

2224
def test_new_person_can_be_added():

0 commit comments

Comments
 (0)