Last active
February 19, 2019 05:54
-
-
Save paulgoetze/971edee21fbdd29d175f1c65c9bde585 to your computer and use it in GitHub Desktop.
Testing Your Python API App with JSON Schema - test_get_user()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_get_user(client): | |
# Do whatever is necessary to create a user here… | |
response = client.get('/users/1') | |
json_data = json.loads(response.data) | |
assert 'data' in json_data | |
assert 'type' in json_data['data'] | |
assert 'id' in json_data['data'] | |
assert 'attributes' in json_data['data'] | |
assert 'email' in json_data['data']['attributes'] | |
assert 'username' in json_data['email']['attributes'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You have a typo on line 12. It should be:
assert 'username' in json_data['data']['attributes']