🐛 Fix constrained bytes, from defaults in Pydantic

#2
This commit is contained in:
Sebastián Ramírez committed 2019-01-05 17:30:27 +04:00
1 parent a5cfee434d
commit 577c5a84db
4 files changed
+30 -10

No files matched your search

@@ -119,3 +119,15 @@ def test_post_file(tmpdir):
response = client.post("/files/", files={"file": open(path, "rb")})
assert response.status_code == 200
assert response.json() == {"file_size": 14}
def test_post_large_file(tmpdir):
default_pydantic_max_size = 2 ** 16
path = os.path.join(tmpdir, "test.txt")
with open(path, "wb") as file:
file.write(b"x" * (default_pydantic_max_size + 1))
client = TestClient(app)
response = client.post("/files/", files={"file": open(path, "rb")})
assert response.status_code == 200
assert response.json() == {"file_size": default_pydantic_max_size + 1}