Skip to content

Instantly share code, notes, and snippets.

@yumike
Created February 19, 2013 11:57
Show Gist options
  • Save yumike/4985204 to your computer and use it in GitHub Desktop.
Save yumike/4985204 to your computer and use it in GitHub Desktop.
pytest <3
@pytest.mark.parametrize(('uri', 'method', 'expected'), [
('/api/user', 'GET', True),
('/api/user/syncs', 'POST', True),
('/api/user/hooks', 'GET', True),
('/api/user/hooks/1', 'PATCH', True),
('/api/user/repos', 'GET', True),
])
def test_requires_auth(app, uri, method, expected):
with app.test_client() as client:
response = client.open(uri, method=method)
assert (response.status_code == 401) is expected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment