Tests: use "%Z" directive while parsing Date header.

This commit is contained in:
Andrey Zelenkov
2018-04-02 15:50:05 +03:00
parent 5177b085b1
commit 2028f3a04b
4 changed files with 19 additions and 7 deletions

View File

@@ -21,8 +21,12 @@ class TestUnitRubyApplication(unit.TestUnitApplicationRuby):
headers = resp['headers']
self.assertRegex(headers.pop('Server'), r'Unit/[\d\.]+',
'server header')
self.assertLess(abs(self.date_to_sec_epoch(headers.pop('Date')) -
self.sec_epoch()), 5, 'date header')
date = headers.pop('Date')
self.assertEqual(date[-4:], ' GMT', 'date header timezone')
self.assertLess(abs(self.date_to_sec_epoch(date) - self.sec_epoch()), 5,
'date header')
self.assertDictEqual(headers, {
'Content-Length': str(len(body)),
'Content-Type': 'text/html',