diff --git a/tests/test_app.py b/tests/test_app.py
index a9790aa..a519507 100644
--- a/tests/test_app.py
+++ b/tests/test_app.py
@@ -576,6 +576,53 @@ class AppHandlerTests(ServerTestCase):
self.assertIn('id="history-list"', body)
self.assertIn("Saved health checks", body)
+ def test_the_history_page_offers_the_csv_download(self):
+ # The export link moved from the dashboard to the history page, and it
+ # carries no download attribute, so the dated filename from
+ # Content-Disposition is the one that wins (sections 31 point 3 and
+ # 32.7 point 5).
+ with self.get("/history") as response:
+ body = response.read().decode("utf-8")
+
+ self.assertEqual(response.status, 200)
+ self.assertIn(
+ 'Download CSV',
+ body,
+ )
+ self.assertNotIn("download=", body)
+
+ def test_robots_txt_is_served_and_refuses_every_crawler(self):
+ # A file that is not listed in STATIC_FILES answers 404, and a crawler
+ # that cannot read the file would still index the service
+ # (section 32.7 point 6).
+ with self.get("/robots.txt") as response:
+ body = response.read().decode("utf-8")
+ content_type = response.headers["Content-Type"]
+
+ self.assertEqual(response.status, 200)
+ self.assertEqual(content_type, "text/plain; charset=utf-8")
+ self.assertIn("User-agent: *", body)
+ self.assertIn("Disallow: /", body)
+
+ def test_every_answer_carries_the_robots_header(self):
+ # The header is written in one place, so the pages, the JSON, the CSV and
+ # the static files are covered by it (section 32.7 point 6). A redirect
+ # is covered in AuthApiTests, which is where one happens.
+ for path in (
+ "/health",
+ "/",
+ "/history",
+ "/styles.css",
+ "/robots.txt",
+ "/api/keys",
+ "/api/export",
+ ):
+ with self.get(path) as response:
+ self.assertEqual(
+ response.headers["X-Robots-Tag"], "noindex, nofollow", path
+ )
+ response.read()
+
def test_every_page_loads_the_session_script(self):
# The five pages load session.js, which puts the CSRF header on every
# fetch, so the existing page scripts do not have to change
@@ -586,16 +633,20 @@ class AppHandlerTests(ServerTestCase):
self.assertEqual(response.status, 200)
self.assertIn('