summaryrefslogtreecommitdiffhomepage
path: root/test/test_python_application.py (follow)
AgeCommit message (Collapse)AuthorFilesLines
2023-02-21Tests: switched to using f-strings.Andrei Zeliankou1-20/+15
Previously, it was necessary to support older versions of Python for compatibility. F-strings were released in Python 3.6. Python 3.5 was marked as unsupported by the end of 2020, so now it's possible to start using f-strings safely for better readability and performance.
2023-02-21Tests: added Python tests with encoding.Andrei Zeliankou1-0/+78
2022-12-14Python: Added "prefix" to configuration.OutOfFocus41-0/+38
This patch gives users the option to set a `"prefix"` attribute for Python applications, either at the top level or for specific `"target"`s. If the attribute is present, the value of `"prefix"` must be a string beginning with `"/"`. If the value of the `"prefix"` attribute is longer than 1 character and ends in `"/"`, the trailing `"/"` is stripped. The purpose of the `"prefix"` attribute is to set the `SCRIPT_NAME` context value for WSGI applications and the `root_path` context value for ASGI applications, allowing applications to properly route requests regardless of the path that the server uses to expose the application. The context value is only set if the request's URL path begins with the value of the `"prefix"` attribute. In all other cases, the `SCRIPT_NAME` or `root_path` values are not set. In addition, for WSGI applications, the value of `"prefix"` will be stripped from the beginning of the request's URL path before it is sent to the application. Reviewed-by: Andrei Zeliankou <zelenkov@nginx.com> Reviewed-by: Artem Konev <artem.konev@nginx.com> Signed-off-by: Alejandro Colomar <alx@nginx.com>
2022-10-11Tests: don't try to return response when "no_recv" is True.Andrei Zeliankou1-2/+1
2022-09-07Tests: minor fixes.Andrei Zeliankou1-40/+4
2022-05-09Tests: added more tests with reconfiguration.Andrei Zeliankou1-30/+0
2022-04-11Tests: style.Andrei Zeliankou1-3/+1
2021-10-18Tests: style.Andrei Zeliankou1-1/+0
2021-04-08Tests: preserving unit.log when run without restart.Max Romanov1-5/+0
Introducing "unit.log.Log" class for "unit.log" file management. Moving "findall()" function into TestApplicationProto. Using "os.kill()" to send signals.
2021-04-05Tests: style.Andrei Zeliankou1-2/+8
2021-02-10Tests: increased timeout in wait_for_record().Andrei Zeliankou1-1/+1
2021-02-04Tests: added tests for "path" option in Python application.Andrei Zeliankou1-0/+37
2021-01-14Tests: added missing checks for configuration results.Andrei Zeliankou1-2/+2
2021-01-13Tests: style.Andrei Zeliankou1-1/+0
2021-01-12Tests: unit_stop() removed where possible.Andrei Zeliankou1-13/+0
Since wait_for_record() was introduced there is no need to stop Unit before parsing unit.log.
2020-12-08Tests: skip_alert() converted to the fixture.Andrei Zeliankou1-4/+3
2020-12-06Tests: options moved to the separate class.Andrei Zeliankou1-1/+1
This change is necessary to separate the logic and prevent possible circular dependency.
2020-11-16Tests: fixing tests interrupt in terminal.Max Romanov1-2/+2
KeyboardInterrupt re-raised.
2020-11-10Tests: supporting instant app parameters in load().Max Romanov1-43/+11
2020-11-05Tests: added Python threading tests.Max Romanov1-0/+41
2020-10-19Tests: fixed unit.log print.Andrei Zeliankou1-7/+9
2020-10-07Tests: minor fixes.Andrei Zeliankou1-2/+3
2020-09-21Tests: added multiple headers concatenation test.Max Romanov1-9/+13
2020-09-21Tests: changing Python application callable name.Max Romanov1-0/+28
2020-09-16Tests: migrated to the pytest.Andrei Zeliankou1-293/+221
2020-08-13Tests: added test with error on loading application.Andrei Zeliankou1-0/+11
2020-05-15Tests: style.Andrei Zeliankou1-2/+2
2020-04-24Tests: introduced module version specification in prerequisites.Andrei Zeliankou1-1/+1
2020-04-14Tests: added test with rescheduling requests.Andrei Zeliankou1-0/+32
2020-04-14Tests: minor fixes and style.Andrei Zeliankou1-6/+10
2020-03-12Tests: added Python input readline and iterator tests.Max Romanov1-3/+70
2019-11-11Tests: added tests for setting user and group.Tiago Natel1-0/+77
2019-11-26Tests: parsing of "Transfer-Encoding: chunked" responses.Tiago Natel1-11/+9
2019-11-14Tests: Python exception tests.Andrei Zeliankou1-0/+157
2019-11-13Tests: added Python test with threading.Andrei Zeliankou1-0/+13
2019-10-23Tests: added test with invalid "working_directory" value.Andrey Zelenkov1-0/+12
2019-09-17HTTP parser: fixed parsing of target after literal space character.Valentin Bartenev1-0/+31
In theory, all space characters in request target must be encoded; however, some clients may violate the specification. For the sake of interoperability, Unit supports unencoded space characters. Previously, if there was a space character before the extension or arguments parts, those parts weren't recognized. Also, quoted symbols and complex target weren't detected after a space character.
2019-09-14Tests: refactored prerequisites model.Andrey Zelenkov1-1/+1
2019-05-30Tests: adjusted skipping tests.Andrey Zelenkov1-5/+5
2019-04-22Tests: read_timeout increased for incomplete requests.Andrey Zelenkov1-1/+1
Also fixed test without \"Host\" header.
2019-04-09Tests: speed up tests.Andrey Zelenkov1-0/+15
2019-04-09Tests: wait_for_record() introduced.Andrey Zelenkov1-8/+8
2019-04-09Tests: style.Andrey Zelenkov1-12/+3
2019-04-09Tests: simplified module checking.Andrey Zelenkov1-2/+1
2019-03-28Tests: unit module refactoring.Andrey Zelenkov1-4/+4
2019-03-26Tests: style.Andrey Zelenkov1-144/+236
2019-03-01Tests: skip more alerts.Andrey Zelenkov1-0/+5
2019-02-28Made QUERY_STRING mandatory.Valentin Bartenev1-1/+0
According to CGI/1.1 RFC 3875: The server MUST set this variable; if the Script-URI does not include a query component, the QUERY_STRING MUST be defined as an empty string (""). Python's PEP 333(3) allows omitting it in WSGI interface; PHP docs force no requirements; PSGI and Rack specifications require it even if empty. When nginx proxies requests over FastCGI, it always provides QUERY_STRING. and some PHP apps have been observed to fail if it is missing (see issue #201 on GitHub). A drawback of this change (besides a small overhead) is that there will be no easy way to tell a missing query string from an empty one (i.e. requests with or without the "?" character); yet, it's negligible compared to the possible benefits of wider application compatibility. This closes #226 issue on GitHub.
2019-02-27Tests: added "Host" and "Connetion" headers where necessary.Andrey Zelenkov1-17/+19
Also minor header organizing.
2019-02-20Tests: skip sendmsg()/recvmsg() alerts for all tests.Andrey Zelenkov1-8/+0
Currently, these alerts may appear in the log when any application exits.