Created
April 19, 2020 20:20
-
-
Save ryanc414/6cff024f0c873c222dc7fba5f4220ce9 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
@pytest.fixture(scope="module") | |
def app(): | |
app = App() | |
print("Starting app") | |
app.start() | |
yield app | |
print("Stopping app") | |
app.stop() | |
def test_app_get(app): | |
"""Test making an HTTP GET request to my app.""" | |
rsp = requests.get(f"{app.listen_addr}/hello") | |
assert rsp.status_code == 200 | |
assert rsp.text == 'Hello, "/hello"' | |
def test_app_put(app): | |
"""Test making an HTTP PUT request to my app.""" | |
rsp = requests.put(f"{app.listen_addr}/hello") | |
assert rsp.status_code == 200 | |
assert rsp.text == 'Hello, "/hello"' | |
def test_app_post(app): | |
"""Test making an HTTP POST request to my app.""" | |
rsp = requests.post(f"{app.listen_addr}/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