Created
June 20, 2019 13:09
-
-
Save wshayes/5fbe1368c7aafad444915e92989d2dc1 to your computer and use it in GitHub Desktop.
[Testclient example for FastAPI] #fastapi
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
# From: euri10 @euri10 Jun 19 10:42 | |
@pytest.mark.parametrize("user, expected_status_code", data) | |
def test_update_user(client, another_user, user, expected_status_code): | |
url = app.url_path_for("enable") | |
response = client.patch(url, params={"email": another_user.email}) | |
assert response.status_code == 401 | |
# client is a small fixture but ymmv: | |
@pytest.fixture() | |
def client(): | |
with TestClient(app) as client: | |
yield client |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment