diff options
-rw-r--r-- | snekbox/api/resources/eval.py | 1 | ||||
-rw-r--r-- | tests/test_integration.py | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/snekbox/api/resources/eval.py b/snekbox/api/resources/eval.py index c3e553a..28b739d 100644 --- a/snekbox/api/resources/eval.py +++ b/snekbox/api/resources/eval.py @@ -122,6 +122,7 @@ class EvalResource: # If `input` is supplied, default `args` to `-c` if "input" in body: body.setdefault("args", ["-c"]) + body["args"].append(body["input"]) try: result = self.nsjail.python3( py_args=body["args"], diff --git a/tests/test_integration.py b/tests/test_integration.py index 5aa1b43..01fa657 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -56,8 +56,8 @@ class IntegrationTests(unittest.TestCase): """Test normal eval requests without files.""" with run_gunicorn(): cases = [ - ({"input": "print('Hello')"}, "Hello"), - ({"args": ["-c", "print('Hello')"]}, "Hello"), + ({"input": "print('Hello')"}, "Hello\n"), + ({"args": ["-c", "print('abc12')"]}, "abc12\n"), ] for body, expected in cases: with self.subTest(body=body): |