summaryrefslogtreecommitdiffhomepage
path: root/test/test_asgi_application.py (follow)
AgeCommit message (Collapse)AuthorFilesLines
2024-02-21Python: bytearray body support for ASGI module.Andrei Zeliankou1-0/+8
@filiphanes requested support for bytearray and memoryview in the request body here: <https://github.com/nginx/unit/issues/648> This patch implements bytearray body support only. Memoryview body still need to be implemented.
2024-01-15Tests: pathlib used where appropriateAndrei Zeliankou1-0/+1
Also fixed various pylint errors and style issues.
2023-11-08Tests: 8XXX used as default port range.Andrei Zeliankou1-2/+2
After the launch of the project, the testing infrastructure was shared with nginx project in some cases. To avoid port overlap, a decision was made to shift the port range for Unit tests. This problem was resolved a long time ago and is no longer relevant, so it is now safe to use port 8XXX range as the default, as it is more appropriate for testing purposes.
2023-06-14Tests: get rid of classes in test files.Andrei Zeliankou1-305/+325
Class usage came from the unittest framework and it was always redundant after migration to the pytest. This commit removes classes from files containing tests to make them more readable and understandable.
2023-06-12Tests: prerequisites checking reworked.Andrei Zeliankou1-5/+4
Prerequisites check moved to the module level to simplify class structure. Discovery and prerequisites checks functions moved to the separate files. Introduced "require" fixture to provide per-test requirements check.
2023-05-29Tests: more fixtures.Andrei Zeliankou1-6/+4
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.
2023-05-25Tests: removed unused variables.Andrei Zeliankou1-2/+2
2023-05-19Tests: added ASGI application with IPv6 address test.Andrei Zeliankou1-0/+9
2023-02-21Tests: switched to using f-strings.Andrei Zeliankou1-8/+7
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.
2022-12-14Python: Added "prefix" to configuration.OutOfFocus41-0/+37
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-4/+2
2022-09-07Tests: minor fixes.Andrei Zeliankou1-41/+4
2022-08-16Tests: added test for ASGI with UNIX socket.Andrei Zeliankou1-0/+10
2022-01-31Tests: removed TestApplicationTLS.get_server_certificate().Andrei Zeliankou1-2/+4
distutils.version is replaced by packaging.version. Also minor style fixes.
2021-11-02Tests: removed unused imports.Andrei Zeliankou1-1/+0
2021-10-18Tests: style.Andrei Zeliankou1-1/+0
2021-04-08Tests: preserving unit.log when run without restart.Max Romanov1-4/+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-5/+8
2021-02-10Tests: increased timeout in wait_for_record().Andrei Zeliankou1-1/+1
2021-01-13Tests: style.Andrei Zeliankou1-1/+0
2020-12-08Tests: skip_alert() converted to the fixture.Andrei Zeliankou1-2/+1
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-10Python: supporting ASGI legacy protocol.Max Romanov1-0/+26
Introducing manual protocol selection for 'universal' apps and frameworks.
2020-11-10Tests: supporting instant app parameters in load().Max Romanov1-37/+13
2020-11-06Tests: fixing racing condition in ASGI threads test.Max Romanov1-5/+5
ASGI threads read all the requests from the queue before start processing it. This why test need to wait a little to let the ASGI thread start request processing and block. In virtual environment any thread or process may be delayed and only method to avoid racing is a reasonable sleep increase.
2020-11-05Tests: added Python threading tests.Max Romanov1-0/+41
2020-10-19Tests: fixed unit.log print.Andrei Zeliankou1-1/+2
2020-10-07Tests: minor fixes.Andrei Zeliankou1-15/+14
2020-10-01Tests: added ASGI HTTP applications.Max Romanov1-0/+403