Skip to content

Commit

Permalink
integration tests: add basic test for cgi
Browse files Browse the repository at this point in the history
  • Loading branch information
niol committed Oct 7, 2024
1 parent 4fbb0af commit bed84a1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion buildconf/integration-tests.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[uwsgi]
inherit = base
main_plugin =
plugins = notfound,python,php,pypy,jvm,jwsgi,psgi
plugins = notfound,python,php,pypy,jvm,jwsgi,psgi,cgi
6 changes: 6 additions & 0 deletions t/cgi/hello.cgi
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

echo "Content-Type: text/plain"
echo
echo "Hello world!"
echo "PATH_INFO=${PATH_INFO}"
14 changes: 14 additions & 0 deletions t/runner
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,20 @@ class UwsgiTest(unittest.TestCase):
with requests.get(f"http://{UWSGI_HTTP}/") as r:
self.assertEqual(r.text, "Hello, world!")

@unittest.skipUnless(*plugins_available(["cgi"]))
def test_psgi_helloworld(self):
self.start_listen_server(
[
"--plugins",
"0:cgi",
"--cgi",
os.path.join(TESTS_DIR, "cgi", "hello.cgi"),
]
)

with requests.get(f"http://{UWSGI_HTTP}/foobar/say_hello") as r:
self.assertEqual(r.text, "Hello world!\nPATH_INFO=/foobar/say_hello\n")


if __name__ == "__main__":
unittest.main()

0 comments on commit bed84a1

Please sign in to comment.