diff options
| author | 2021-05-19 15:06:51 -0400 | |
|---|---|---|
| committer | 2021-05-19 15:06:51 -0400 | |
| commit | ed1a945f79868ddbdb8aec4ad86ff9db712d8a8f (patch) | |
| tree | 9383cf948788290ea5bd78bf15cf3a734479702c /tests | |
| parent | chore: Apply suggestions to improve documentation (diff) | |
chore: Use TestCase.subTest
Diffstat (limited to '')
| -rw-r--r-- | tests/api/test_eval.py | 24 | 
1 files changed, 12 insertions, 12 deletions
| diff --git a/tests/api/test_eval.py b/tests/api/test_eval.py index 7270905..bdeee3e 100644 --- a/tests/api/test_eval.py +++ b/tests/api/test_eval.py @@ -26,22 +26,22 @@ class TestEvalResource(SnekAPITestCase):          self.assertEqual(expected, result.json)      def test_post_invalid_data_400(self): -        input_body = {"input": 400} -        args_body = {"input": "", "args": [400]} +        bodies = ( +            {"input": 400}, {"input": "", "args": [400]} +        ) -        input_result = self.simulate_post(self.PATH, json=input_body) -        args_result = self.simulate_post(self.PATH, json=args_body) +        for body in bodies: +            with self.subTest(): +                result = self.simulate_post(self.PATH, json=body) -        self.assertEqual(input_result.status_code, 400) -        self.assertEqual(args_result.status_code, 400) +                self.assertEqual(result.status_code, 400) -        expected = { -            "title": "Request data failed validation", -            "description": "400 is not of type 'string'" -        } +                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) +                self.assertEqual(expected, result.json)      def test_post_invalid_content_type_415(self):          body = "{'input': 'foo'}" | 
