Skip to content

Instantly share code, notes, and snippets.

@dyspop
Last active December 13, 2017 18:13
Show Gist options
  • Save dyspop/041e5c76da9b677a0e31f1ad3315371f to your computer and use it in GitHub Desktop.
Save dyspop/041e5c76da9b677a0e31f1ad3315371f to your computer and use it in GitHub Desktop.
pytest style in question
"""Tests for each individual function in the Client."""
import responsysrest as r
def dict_contains_key(d, k):
"""Test if the key is in the dictionary."""
return k in d
def test_get_context():
"""Test the get context function."""
context = r.get_context()
# is dict
assert type(context) == dict
# contains required keys
keys = ['authToken', 'endPoint']
for key in keys:
assert dict_contains_key(context, key)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment