home
·
contact
·
privacy
projects
/
plomtask
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Redirect / to /day, throw informative Exception on other unknown paths.
[plomtask]
/
tests
/
days.py
diff --git
a/tests/days.py
b/tests/days.py
index 06e4302d71aaba58867e961506806a792c1fe807..c6fdcc783db16bdd637d7944ced84ddfe19a2622 100644
(file)
--- a/
tests/days.py
+++ b/
tests/days.py
@@
-91,7
+91,7
@@
class TestsWithServer(TestCaseWithServer):
"""Tests against our HTTP server/handler (and database)."""
def test_do_GET(self) -> None:
"""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.conn.request('GET', '/day')
self.assertEqual(self.conn.getresponse().status, 200)
self.conn.request('GET', '/day?date=3000-01-01')
@@
-108,3
+108,7
@@
class TestsWithServer(TestCaseWithServer):
self.assertEqual(self.conn.getresponse().status, 200)
self.conn.request('GET', '/calendar?start=foo')
self.assertEqual(self.conn.getresponse().status, 400)
self.assertEqual(self.conn.getresponse().status, 200)
self.conn.request('GET', '/calendar?start=foo')
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')