We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3f9fc63 commit 2ca9964Copy full SHA for 2ca9964
tests/people_test.py
@@ -14,9 +14,11 @@ def test_read_all_has_kent():
14
# we can assert on the response status code
15
assert_that(response.status_code).is_equal_to(requests.codes.ok)
16
# 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')
+ response_content = response.json()
+
+ # 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')
22
23
24
def test_new_person_can_be_added():
0 commit comments