Skip to content

Instantly share code, notes, and snippets.

@turtlemonvh
Last active December 19, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save turtlemonvh/5967678 to your computer and use it in GitHub Desktop.
Save turtlemonvh/5967678 to your computer and use it in GitHub Desktop.
Embracing duck typing
import api
# Create test client
cl = Client()
# Hit all endpoints defined in api file
for _, obj in inspect.getmembers(api):
try:
test_url = '/api/v1/%s/' % obj.Meta.resource_name
response = cl.get(test_url, {'format': 'json'})
self.assertEqual(response.status_code, 200)
except AttributeError:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment