| 564 | |
| 565 | |
| 566 | def test_bp_static(app: Sanic): |
| 567 | current_file = inspect.getfile(inspect.currentframe()) |
| 568 | with open(current_file, "rb") as file: |
| 569 | current_file_contents = file.read() |
| 570 | |
| 571 | blueprint = Blueprint("test_static") |
| 572 | |
| 573 | blueprint.static("/testing.file", current_file) |
| 574 | |
| 575 | app.blueprint(blueprint) |
| 576 | |
| 577 | request, response = app.test_client.get("/testing.file") |
| 578 | assert response.status == 200 |
| 579 | assert response.body == current_file_contents |
| 580 | |
| 581 | |
| 582 | @pytest.mark.parametrize("file_name", ["test.html"]) |