From 4dfd47afed5f870bcfb09c7d5d29f4373eeac420 Mon Sep 17 00:00:00 2001 From: ToxicKidz Date: Tue, 18 May 2021 18:34:44 -0400 Subject: chore: Add tests for py_args and ns_jail args --- tests/api/test_eval.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/api/test_eval.py') diff --git a/tests/api/test_eval.py b/tests/api/test_eval.py index 3350763..7270905 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): + input_body = {"input": 400} + args_body = {"input": "", "args": [400]} + + input_result = self.simulate_post(self.PATH, json=input_body) + args_result = self.simulate_post(self.PATH, json=args_body) + + self.assertEqual(input_result.status_code, 400) + self.assertEqual(args_result.status_code, 400) + + expected = { + "title": "Request data failed validation", + "description": "400 is not of type 'string'" + } + + self.assertEqual(expected, input_result.json) + self.assertEqual(expected, args_result.json) + def test_post_invalid_content_type_415(self): body = "{'input': 'foo'}" headers = {"Content-Type": "application/xml"} -- cgit v1.2.3