summaryrefslogtreecommitdiffhomepage
path: root/test/test_perl_application.py
diff options
context:
space:
mode:
authorAndrey Zelenkov <zelenkov@nginx.com>2018-03-21 18:26:40 +0300
committerAndrey Zelenkov <zelenkov@nginx.com>2018-03-21 18:26:40 +0300
commitc7e67446a3054998893d64cbab150810d2a99aa5 (patch)
tree55e447f271a8553112d93149851b71a83eb5af43 /test/test_perl_application.py
parent37051b6c15cce7d6ab01c50e1086f8ef0b34e93d (diff)
downloadunit-c7e67446a3054998893d64cbab150810d2a99aa5.tar.gz
unit-c7e67446a3054998893d64cbab150810d2a99aa5.tar.bz2
Tests: Ruby module.
Diffstat (limited to 'test/test_perl_application.py')
-rw-r--r--test/test_perl_application.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/test/test_perl_application.py b/test/test_perl_application.py
index 45f8ab33..755e115b 100644
--- a/test/test_perl_application.py
+++ b/test/test_perl_application.py
@@ -1,5 +1,3 @@
-import re
-import time
import unittest
import unit
@@ -23,9 +21,8 @@ class TestUnitPerlApplication(unit.TestUnitApplicationPerl):
headers = resp['headers']
self.assertRegex(headers.pop('Server'), r'Unit/[\d\.]+',
'server header')
- self.assertLess(abs(time.mktime(time.gmtime()) -
- time.mktime(time.strptime(headers.pop('Date'),
- '%a, %d %b %Y %H:%M:%S GMT'))), 5, 'date header')
+ self.assertLess(abs(self.date_to_sec_epoch(headers.pop('Date')) -
+ self.sec_epoch()), 5, 'date header')
self.assertDictEqual(headers, {
'Content-Length': str(len(body)),
'Content-Type': 'text/html',
@@ -88,10 +85,11 @@ class TestUnitPerlApplication(unit.TestUnitApplicationPerl):
self.assertEqual(self.get()['body'], '1', 'errors result')
- with open(self.testdir + '/unit.log', 'r') as f:
- m = re.search('Error in application', f.read())
+ self.stop()
- self.assertIsNotNone(m, 'errors log')
+ self.assertIsNotNone(
+ self.search_in_log(r'\[error\].+Error in application'),
+ 'errors print')
def test_perl_application_header_equal_names(self):
self.load('header_equal_names')