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 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