Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
from fastapi.testclient import TestClient
from main import app
client = TestClient(app)
def test_user_main():
test1 = {
"id": 1,
"name": "natsumi",
}
response = client.post("/user/", json=test1)
assert response.status_code == 200
def test_user_422():
test1 = {
"id": "string", # string, not int
"name": "natsumi",
}
response = client.post("/user/", json=test1)
assert response.status_code == 422
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment