Last active
April 28, 2020 10:53
-
-
Save ryanc414/804e76e9f38c5183b80d1e4ad97ff357 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class AppClient: | |
def __init__(self, app_addr): | |
self._app_addr = app_addr | |
def request(self, method, path): | |
return requests.request(method, f"{self._app_addr}{path}") | |
@pytest.fixture(scope="function") | |
def app_client(app): | |
return AppClient(app.listen_addr) | |
@pytest.mark.parametrize("method", ["GET", "PUT", "POST"]) | |
def test_app(app_client, method): | |
"""Test making an HTTP request to my app.""" | |
rsp = app_client.request(method, "/hello") | |
assert rsp.status_code == 200 | |
assert rsp.text == 'Hello, "/hello"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment