Skip to content

Commit

Permalink
Failing test for static file larger than 4096 bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Willison committed Jul 26, 2018
1 parent 590db3d commit e2d6665
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_staticfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ def test_staticfile(tmpdir):
assert response.text == "<file content>"


def test_large_staticfile(tmpdir):
path = os.path.join(tmpdir, "example.txt")
content = "this is a lot of content" * 200
print("content len = ", len(content))
with open(path, "w") as file:
file.write(content)

app = StaticFile(path=path)
client = TestClient(app)
response = client.get("/")
assert response.status_code == 200
assert len(content) == len(response.text)
assert content == response.text


def test_staticfile_post(tmpdir):
path = os.path.join(tmpdir, "example.txt")
with open(path, "w") as file:
Expand Down

0 comments on commit e2d6665

Please sign in to comment.