🐛 Fix Form and File params must always be embeded

and add tests for forms and files
This commit is contained in:
Sebastián Ramírez
2018-12-22 08:23:35 +04:00
parent b38fb937b0
commit 748dc375db
4 changed files with 121 additions and 6 deletions

View File

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