X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;ds=sidebyside;f=tests%2Ftest_days.py;fp=tests%2Ftest_days.py;h=cc0f80db857b2fdf4ad83124d117b39c2cdb5135;hb=2306600c8195553d120f7eb042ef2afdd983fc65;hp=7daf7498214375914493cd1bab399326159772f0;hpb=df5c37b734bedcb5d026558c32b40977bd028a5a;p=plomtask
diff --git a/tests/test_days.py b/tests/test_days.py
index 7daf749..cc0f80d 100644
--- a/tests/test_days.py
+++ b/tests/test_days.py
@@ -115,33 +115,33 @@ class TestsWithServer(TestsWithDB):
def test_do_POST_day(self):
"""Test POST /day and its effect on the database."""
- conn = HTTPConnection(*self.httpd.server_address)
+ http_conn = HTTPConnection(*self.httpd.server_address)
form_data = {'comment': 'foo'}
encoded_form_data = urlencode(form_data).encode('utf-8')
headers = {'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': str(len(encoded_form_data))}
- conn.request('POST', '/day?date=FOO',
- body=encoded_form_data, headers=headers)
- self.assertEqual(conn.getresponse().status, 400)
+ http_conn.request('POST', '/day?date=FOO',
+ body=encoded_form_data, headers=headers)
+ self.assertEqual(http_conn.getresponse().status, 400)
self.assertEqual(Day.all(self.db_conn), [])
- conn.request('POST', '/day?date=2024-01-01',
- body=encoded_form_data, headers=headers)
- self.assertEqual(conn.getresponse().status, 302)
+ http_conn.request('POST', '/day?date=2024-01-01',
+ body=encoded_form_data, headers=headers)
+ self.assertEqual(http_conn.getresponse().status, 302)
retrieved = Day.by_date(self.db_conn, '2024-01-01')
self.assertEqual(retrieved.comment, 'foo')
self.assertEqual(Day.all(self.db_conn), [retrieved])
def test_do_GET(self):
"""Test /day and /calendar response codes."""
- conn = HTTPConnection(*self.httpd.server_address)
- conn.request('GET', '/day')
- self.assertEqual(conn.getresponse().status, 200)
- conn.request('GET', '/day?date=3000-01-01')
- self.assertEqual(conn.getresponse().status, 200)
- conn.request('GET', '/day?date=FOO')
- self.assertEqual(conn.getresponse().status, 400)
- conn.request('GET', '/calendar')
- self.assertEqual(conn.getresponse().status, 200)
+ http_conn = HTTPConnection(*self.httpd.server_address)
+ http_conn.request('GET', '/day')
+ self.assertEqual(http_conn.getresponse().status, 200)
+ http_conn.request('GET', '/day?date=3000-01-01')
+ self.assertEqual(http_conn.getresponse().status, 200)
+ http_conn.request('GET', '/day?date=FOO')
+ self.assertEqual(http_conn.getresponse().status, 400)
+ http_conn.request('GET', '/calendar')
+ self.assertEqual(http_conn.getresponse().status, 200)
def tearDown(self):
self.httpd.shutdown()