X-Git-Url: https://plomlompom.com/repos/berlin_corona.txt?a=blobdiff_plain;f=tests%2Fdays.py;h=c6fdcc783db16bdd637d7944ced84ddfe19a2622;hb=17be4d0a78f3d1b56df588807b6bda05bb2d8ebc;hp=61a27edbb0d266b892182c241d769ae36a5846b4;hpb=8ae8877e3e2588db76285e7e3ddfb8c7b9948a96;p=plomtask diff --git a/tests/days.py b/tests/days.py index 61a27ed..c6fdcc7 100644 --- a/tests/days.py +++ b/tests/days.py @@ -91,13 +91,13 @@ class TestsWithServer(TestCaseWithServer): """Tests against our HTTP server/handler (and database).""" def test_do_GET(self) -> None: - """Test /day and /calendar response codes.""" + """Test /day and /calendar response codes, and / redirect.""" self.conn.request('GET', '/day') self.assertEqual(self.conn.getresponse().status, 200) self.conn.request('GET', '/day?date=3000-01-01') self.assertEqual(self.conn.getresponse().status, 200) self.conn.request('GET', '/day?date=FOO') - self.assertEqual(self.conn.getresponse().status, 401) + self.assertEqual(self.conn.getresponse().status, 400) self.conn.request('GET', '/calendar') self.assertEqual(self.conn.getresponse().status, 200) self.conn.request('GET', '/calendar?start=&end=') @@ -107,4 +107,8 @@ class TestsWithServer(TestCaseWithServer): self.conn.request('GET', '/calendar?start=2024-01-01&end=2025-01-01') self.assertEqual(self.conn.getresponse().status, 200) self.conn.request('GET', '/calendar?start=foo') - self.assertEqual(self.conn.getresponse().status, 401) + self.assertEqual(self.conn.getresponse().status, 400) + self.conn.request('GET', '/') + response = self.conn.getresponse() + self.assertEqual(response.status, 302) + self.assertEqual(response.getheader('Location'), '/day')