aboutsummaryrefslogtreecommitdiffstats
path: root/tests/api
diff options
context:
space:
mode:
authorGravatar ionite34 <[email protected]>2022-11-28 12:16:42 +0800
committerGravatar ionite34 <[email protected]>2022-11-28 12:16:42 +0800
commit84e73c12bb6e9b51c9e1bd4a7b6eae7ce65ed46e (patch)
tree446439843235ab65556da0b0a7fc5c77e5a69c9d /tests/api
parentparse_files refactor as instance method (diff)
Add compat support for `input` arg
Diffstat (limited to 'tests/api')
-rw-r--r--tests/api/test_eval.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/tests/api/test_eval.py b/tests/api/test_eval.py
index 64d7ba6..26ac38a 100644
--- a/tests/api/test_eval.py
+++ b/tests/api/test_eval.py
@@ -5,12 +5,16 @@ class TestEvalResource(SnekAPITestCase):
PATH = "/eval"
def test_post_valid_200(self):
- body = {"args": ["-c", "print('output')"]}
- result = self.simulate_post(self.PATH, json=body)
-
- self.assertEqual(result.status_code, 200)
- self.assertEqual("output", result.json["stdout"])
- self.assertEqual(0, result.json["returncode"])
+ cases = [
+ {"args": ["-c", "print('output')"]},
+ {"input": "print('hello')"},
+ ]
+ for body in cases:
+ with self.subTest():
+ result = self.simulate_post(self.PATH, json=body)
+ self.assertEqual(result.status_code, 200)
+ self.assertEqual("output", result.json["stdout"])
+ self.assertEqual(0, result.json["returncode"])
def test_post_invalid_schema_400(self):
body = {"stuff": "foo"}
@@ -20,7 +24,7 @@ class TestEvalResource(SnekAPITestCase):
expected = {
"title": "Request data failed validation",
- "description": "'args' is a required property",
+ "description": "{'stuff': 'foo'} is not valid under any of the given schemas",
}
self.assertEqual(expected, result.json)