From 07789a23e9c513dba87b020fae2989a57955e8a6 Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Sun, 6 Dec 2020 16:01:59 +0000 Subject: Tests: options moved to the separate class. This change is necessary to separate the logic and prevent possible circular dependency. --- test/test_access_log.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/test_access_log.py') diff --git a/test/test_access_log.py b/test/test_access_log.py index 511ce6c5..0a0a6633 100644 --- a/test/test_access_log.py +++ b/test/test_access_log.py @@ -2,9 +2,9 @@ import time import pytest -from conftest import option from conftest import unit_stop from unit.applications.lang.python import TestApplicationPython +from unit.option import option class TestAccessLog(TestApplicationPython): -- cgit From f5ac1432463e58873b2c801b6db64dbe4d0e8f1c Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Tue, 12 Jan 2021 06:20:23 +0000 Subject: Tests: unit_stop() removed where possible. Since wait_for_record() was introduced there is no need to stop Unit before parsing unit.log. --- test/test_access_log.py | 31 ------------------------------- 1 file changed, 31 deletions(-) (limited to 'test/test_access_log.py') diff --git a/test/test_access_log.py b/test/test_access_log.py index 0a0a6633..e82e42e3 100644 --- a/test/test_access_log.py +++ b/test/test_access_log.py @@ -2,7 +2,6 @@ import time import pytest -from conftest import unit_stop from unit.applications.lang.python import TestApplicationPython from unit.option import option @@ -50,8 +49,6 @@ class TestAccessLog(TestApplicationPython): body='0123456789', ) - unit_stop() - assert ( self.wait_for_record(r'"POST / HTTP/1.1" 200 10') is not None ), 'keepalive 2' @@ -78,8 +75,6 @@ Connection: close raw=True, ) - unit_stop() - assert ( self.wait_for_record(r'"GET / HTTP/1.1" 200 0 "Referer-1" "-"') is not None @@ -100,8 +95,6 @@ Connection: close self.get(sock_type='ipv6') - unit_stop() - assert ( self.wait_for_record( r'::1 - - \[.+\] "GET / HTTP/1.1" 200 0 "-" "-"' @@ -120,8 +113,6 @@ Connection: close self.get(sock_type='unix', addr=addr) - unit_stop() - assert ( self.wait_for_record( r'unix: - - \[.+\] "GET / HTTP/1.1" 200 0 "-" "-"' @@ -140,8 +131,6 @@ Connection: close } ) - unit_stop() - assert ( self.wait_for_record(r'"GET / HTTP/1.1" 200 0 "referer-value" "-"') is not None @@ -158,8 +147,6 @@ Connection: close } ) - unit_stop() - assert ( self.wait_for_record( r'"GET / HTTP/1.1" 200 0 "-" "user-agent-value"' @@ -172,8 +159,6 @@ Connection: close self.get(http_10=True) - unit_stop() - assert ( self.wait_for_record(r'"GET / HTTP/1.0" 200 0 "-" "-"') is not None ), 'http 1.0' @@ -187,8 +172,6 @@ Connection: close time.sleep(1) - unit_stop() - assert ( self.wait_for_record(r'"GE" 400 0 "-" "-"') is not None ), 'partial' @@ -200,8 +183,6 @@ Connection: close self.http(b"""GET /\n""", raw=True) - unit_stop() - assert ( self.wait_for_record(r'"GET /" 400 \d+ "-" "-"') is not None ), 'partial 2' @@ -215,8 +196,6 @@ Connection: close time.sleep(1) - unit_stop() - assert ( self.wait_for_record(r'"GET /" 400 0 "-" "-"') is not None ), 'partial 3' @@ -230,8 +209,6 @@ Connection: close time.sleep(1) - unit_stop() - assert ( self.wait_for_record(r'"GET / HTTP/1.1" 400 0 "-" "-"') is not None ), 'partial 4' @@ -244,8 +221,6 @@ Connection: close self.get(headers={'Connection': 'close'}) - unit_stop() - assert ( self.wait_for_record(r'"GET / HTTP/1.1" 400 \d+ "-" "-"') is not None @@ -256,8 +231,6 @@ Connection: close self.get(url='/?blah&var=val') - unit_stop() - assert ( self.wait_for_record( r'"GET /\?blah&var=val HTTP/1.1" 200 0 "-" "-"' @@ -272,8 +245,6 @@ Connection: close self.get(url='/delete') - unit_stop() - assert self.search_in_log(r'/delete', 'access.log') is None, 'delete' def test_access_log_change(self, temp_dir): @@ -285,8 +256,6 @@ Connection: close self.get() - unit_stop() - assert ( self.wait_for_record(r'"GET / HTTP/1.1" 200 0 "-" "-"', 'new.log') is not None -- cgit From 6dc9c47ccd26b23b61b7522803a667c2e515e260 Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Wed, 13 Jan 2021 06:22:43 +0000 Subject: Tests: style. --- test/test_access_log.py | 1 - 1 file changed, 1 deletion(-) (limited to 'test/test_access_log.py') diff --git a/test/test_access_log.py b/test/test_access_log.py index e82e42e3..045473ae 100644 --- a/test/test_access_log.py +++ b/test/test_access_log.py @@ -1,7 +1,6 @@ import time import pytest - from unit.applications.lang.python import TestApplicationPython from unit.option import option -- cgit From d43a84139d1adedbae8def67c8bbee09d8cf4581 Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Thu, 14 Jan 2021 03:04:20 +0000 Subject: Tests: added missing checks for configuration results. --- test/test_access_log.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'test/test_access_log.py') diff --git a/test/test_access_log.py b/test/test_access_log.py index 045473ae..65d5e50a 100644 --- a/test/test_access_log.py +++ b/test/test_access_log.py @@ -90,7 +90,9 @@ Connection: close def test_access_log_ipv6(self): self.load('empty') - self.conf({"[::1]:7080": {"pass": "applications/empty"}}, 'listeners') + assert 'success' in self.conf( + {"[::1]:7080": {"pass": "applications/empty"}}, 'listeners' + ) self.get(sock_type='ipv6') @@ -106,7 +108,7 @@ Connection: close addr = option.temp_dir + '/sock' - self.conf( + assert 'success' in self.conf( {"unix:" + addr: {"pass": "applications/empty"}}, 'listeners' ) @@ -240,7 +242,7 @@ Connection: close def test_access_log_delete(self): self.load('empty') - self.conf_delete('access_log') + assert 'success' in self.conf_delete('access_log') self.get(url='/delete') @@ -251,7 +253,9 @@ Connection: close self.get() - self.conf('"' + option.temp_dir + '/new.log"', 'access_log') + assert 'success' in self.conf( + '"' + option.temp_dir + '/new.log"', 'access_log' + ) self.get() -- cgit