summaryrefslogtreecommitdiffhomepage
path: root/test/test_java_application.py
diff options
context:
space:
mode:
authorAndrei Zeliankou <zelenkov@nginx.com>2023-05-29 16:45:49 +0100
committerAndrei Zeliankou <zelenkov@nginx.com>2023-05-29 16:45:49 +0100
commit31ff94add9c4043a753683d9e8b68733c69aa1ac (patch)
tree1737c36a2641129a4de775c6058cc07b9cdca0f6 /test/test_java_application.py
parentf55818059c01ff9e61bee8107ed1389fe272a787 (diff)
downloadunit-31ff94add9c4043a753683d9e8b68733c69aa1ac.tar.gz
unit-31ff94add9c4043a753683d9e8b68733c69aa1ac.tar.bz2
Tests: more fixtures.
Common methods from applications/proto.py converted to the fixtures. sysctl check moved to the specific file where it is using. Some options moved to the constructor to have early access.
Diffstat (limited to 'test/test_java_application.py')
-rw-r--r--test/test_java_application.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/test/test_java_application.py b/test/test_java_application.py
index 82719dd7..85cf71a1 100644
--- a/test/test_java_application.py
+++ b/test/test_java_application.py
@@ -128,7 +128,9 @@ class TestJavaApplication(TestApplicationJava):
assert headers['X-Session-New'] == 'false', 'session resume'
assert session_id == headers['X-Session-Id'], 'session same id'
- def test_java_application_session_active(self):
+ def test_java_application_session_active(
+ self, date_to_sec_epoch, sec_epoch
+ ):
self.load('session_inactive')
resp = self.get(
@@ -144,10 +146,8 @@ class TestJavaApplication(TestApplicationJava):
assert resp['headers']['X-Session-Interval'] == '4', 'session interval'
assert (
abs(
- self.date_to_sec_epoch(
- resp['headers']['X-Session-Last-Access-Time']
- )
- - self.sec_epoch()
+ date_to_sec_epoch(resp['headers']['X-Session-Last-Access-Time'])
+ - sec_epoch
)
< 5
), 'session last access time'
@@ -943,7 +943,7 @@ class TestJavaApplication(TestApplicationJava):
), 'set date header'
assert headers['X-Get-Date'] == date, 'get date header'
- def test_java_application_multipart(self, temp_dir):
+ def test_java_application_multipart(self, search_in_file, temp_dir):
self.load('multipart')
reldst = '/uploads'
@@ -979,7 +979,7 @@ class TestJavaApplication(TestApplicationJava):
assert resp['status'] == 200, 'multipart status'
assert re.search(r'sample\.txt created', resp['body']), 'multipart body'
assert (
- self.search_in_log(
+ search_in_file(
r'^Data from sample file$', name=f'{reldst}/sample.txt'
)
is not None