From 94fe1fb29102dce384b776c1ccd1823e37f5287f Mon Sep 17 00:00:00 2001 From: ionite34 Date: Mon, 28 Nov 2022 12:20:35 +0800 Subject: Add input/args integration test --- tests/test_integration.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests/test_integration.py') 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(): -- cgit v1.2.3