diff options
author | 2021-05-19 12:32:11 -0700 | |
---|---|---|
committer | 2021-05-19 12:32:11 -0700 | |
commit | 981afed494527bb894065a7d9e49133751eee485 (patch) | |
tree | 9383cf948788290ea5bd78bf15cf3a734479702c /tests/api/test_eval.py | |
parent | Merge PR #100 - avoid decoding of invalid Unicode output (diff) | |
parent | chore: Use TestCase.subTest (diff) |
Merge #108 - allow custom arguments to be passed to eval
Diffstat (limited to 'tests/api/test_eval.py')
-rw-r--r-- | tests/api/test_eval.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/api/test_eval.py b/tests/api/test_eval.py index 3350763..bdeee3e 100644 --- a/tests/api/test_eval.py +++ b/tests/api/test_eval.py @@ -25,6 +25,24 @@ class TestEvalResource(SnekAPITestCase): self.assertEqual(expected, result.json) + def test_post_invalid_data_400(self): + bodies = ( + {"input": 400}, {"input": "", "args": [400]} + ) + + for body in bodies: + with self.subTest(): + result = self.simulate_post(self.PATH, json=body) + + self.assertEqual(result.status_code, 400) + + expected = { + "title": "Request data failed validation", + "description": "400 is not of type 'string'" + } + + self.assertEqual(expected, result.json) + def test_post_invalid_content_type_415(self): body = "{'input': 'foo'}" headers = {"Content-Type": "application/xml"} |