-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use example apps for integration tests
- Loading branch information
Showing
3 changed files
with
38 additions
and
69 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"""We use the apps in examples/ for integration tests.""" | ||
import pytest | ||
|
||
from examples.kitchen_sink import app as kitchen_sink_app | ||
|
||
class TestKitchenSinkApp: | ||
|
||
@pytest.fixture() | ||
def client(self, loop, create_client): | ||
kitchen_sink_app._loop = loop | ||
return create_client(kitchen_sink_app) | ||
|
||
def test_index(self, client): | ||
res = client.get('/') | ||
assert res.status_code == 200 | ||
assert res.json == 'Welcome!' | ||
|
||
def test_api_index(self, client): | ||
res = client.get('/api/') | ||
assert res.status_code == 200 | ||
assert res.json == {'message': 'Welcome to the API!'} | ||
|
||
def test_api_index_append_slash(self, client): | ||
res = client.get('/api') | ||
assert res.status_code == 301 | ||
res = res.follow() | ||
assert res.status_code == 200 | ||
assert res.request.path == '/api/' | ||
|
||
def test_api_index_merge_slashes(self, client): | ||
res = client.get('/api//') | ||
assert res.status_code == 301 | ||
res = res.follow() | ||
assert res.status_code == 200 | ||
assert res.request.path == '/api/' | ||
|
This file was deleted.
Oops, something went wrong.