serve per-instance static files at custom-static/

This commit is contained in:
2022-12-31 10:51:36 -06:00
parent e9af2de21e
commit 715bc38d78
4 changed files with 39 additions and 1 deletions

View File

@@ -218,3 +218,23 @@ def test_extra_footer_per_page(client):
assert b'<div class="extra-footer">' not in response.data
response = client.get('/index-but-with-footer')
assert b'<div class="extra-footer"><i>ooo <a href="a">a</a></i>' in response.data
def test_serving_static_files(client):
"""Test the usage of send_from_directory to serve extra static files."""
response = client.get('/custom-static/css/warm.css')
assert response.status_code == 200
# can't serve directories, just files
response = client.get('/custom-static/')
assert response.status_code == 404
response = client.get('/custom-static/css/')
assert response.status_code == 404
response = client.get('/custom-static/css')
assert response.status_code == 404
# can't serve files that don't exist or bad paths
response = client.get('/custom-static/css/cold.css')
assert response.status_code == 404
response = client.get('/custom-static/css/../../unreachable.md')
assert response.status_code == 404

View File

@@ -0,0 +1,3 @@
* {
color: red;
}