Last active
December 19, 2015 14:09
-
-
Save turtlemonvh/5967678 to your computer and use it in GitHub Desktop.
Embracing duck typing
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
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