summaryrefslogtreecommitdiffhomepage
path: root/test/python
diff options
context:
space:
mode:
authorGourav <gouravkandoria1500@gmail.com>2024-06-26 12:07:09 +0530
committerAndrew Clayton <a.clayton@nginx.com>2024-07-02 19:13:14 +0100
commitd67d350142d4ef9a9cdbfc2bb4a6b2d8f261deb1 (patch)
tree4c939fcff01fff44076b747c240b46c50f93c8c3 /test/python
parenta9aa9e76db2766a681350c09947df848898531f6 (diff)
downloadunit-d67d350142d4ef9a9cdbfc2bb4a6b2d8f261deb1.tar.gz
unit-d67d350142d4ef9a9cdbfc2bb4a6b2d8f261deb1.tar.bz2
tests: Add tests for python application factories
Add the following tests cases: 1. When "factory" key is used inside the "targets" option. 2. When "factory" key is used at the root level of python application config. 3. When factory returns invalid callable or When factory is invalid callable Link: <https://github.com/nginx/unit/pull/1336> [ Commit subject & message formatting tweaks - Andrew ] Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to 'test/python')
-rw-r--r--test/python/factory/wsgi.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/python/factory/wsgi.py b/test/python/factory/wsgi.py
new file mode 100644
index 00000000..8ad4887b
--- /dev/null
+++ b/test/python/factory/wsgi.py
@@ -0,0 +1,23 @@
+def wsgi_a(env, start_response):
+ start_response("200", [("Content-Length", "1")])
+ return [b"1"]
+
+
+def wsgi_b(env, start_response):
+ start_response("200", [("Content-Length", "1")])
+ return [b"2"]
+
+
+def wsgi_a_factory():
+ return wsgi_a
+
+
+def wsgi_b_factory():
+ return wsgi_b
+
+
+wsgi_invalid_callable = None
+
+
+def wsgi_factory_returning_invalid_callable():
+ return wsgi_invalid_callable