aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ionite34 <[email protected]>2022-11-28 12:20:35 +0800
committerGravatar ionite34 <[email protected]>2022-11-28 12:20:35 +0800
commit94fe1fb29102dce384b776c1ccd1823e37f5287f (patch)
tree5ea9466186c30486d0d4b4b94346a5c492ca6317
parentAdd compat support for `input` arg (diff)
Add input/args integration test
-rw-r--r--tests/test_integration.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_integration.py b/tests/test_integration.py
index ba0d9b5..5aa1b43 100644
--- a/tests/test_integration.py
+++ b/tests/test_integration.py
@@ -52,6 +52,19 @@ class IntegrationTests(unittest.TestCase):
self.assertTrue(all(status == 200 for status in statuses))
self.assertTrue(all(json.loads(response)["returncode"] == 0 for response in responses))
+ def test_eval(self):
+ """Test normal eval requests without files."""
+ with run_gunicorn():
+ cases = [
+ ({"input": "print('Hello')"}, "Hello"),
+ ({"args": ["-c", "print('Hello')"]}, "Hello"),
+ ]
+ for body, expected in cases:
+ with self.subTest(body=body):
+ response, status = snekbox_request(body)
+ self.assertEqual(status, 200)
+ self.assertEqual(json.loads(response)["stdout"], expected)
+
def test_files_send_receive(self):
"""Test sending and receiving files to snekbox."""
with run_gunicorn():