| 1 |
from pathlib import Path |
| 2 |
from typing import Any, cast |
| 3 |
|
| 4 |
from fastapi.testclient import TestClient |
| 5 |
|
| 6 |
from docs_src.custom_response import tutorial008_py310 |
| 7 |
from docs_src.custom_response.tutorial008_py310 import app |
| 8 |
|
| 9 |
client = TestClient(app) |
| 10 |
|
| 11 |
|
| 12 |
def test_get(tmp_path: Path): |
| 13 |
file_path: Path = tmp_path / "large-video-file.mp4" |
| 14 |
cast(Any, tutorial008_py310).some_file_path = str(file_path) |
| 15 |
test_content = b"Fake video bytes" |
| 16 |
file_path.write_bytes(test_content) |
| 17 |
response = client.get("/") |
| 18 |
assert response.content == test_content |