mirror of
https://github.com/fastapi/fastapi.git
synced 2026-04-04 07:12:48 -04:00
🐛 Fix Form and File params must always be embeded
and add tests for forms and files
This commit is contained in:
@@ -147,13 +147,11 @@ username_and_password_required = {
|
||||
)
|
||||
def test_post_body_form(path, body, expected_status, expected_response):
|
||||
response = client.post(path, data=body)
|
||||
print(response.text)
|
||||
assert response.status_code == expected_status
|
||||
assert response.json() == expected_response
|
||||
|
||||
|
||||
def test_post_body_json():
|
||||
response = client.post("/login/", json={"username": "Foo", "password": "secret"})
|
||||
print(response.text)
|
||||
assert response.status_code == 422
|
||||
assert response.json() == username_and_password_required
|
||||
|
||||
Reference in New Issue
Block a user