From 682d3b6b17f4b60aab7f804789146ac8af84b071 Mon Sep 17 00:00:00 2001 From: Roberto Hueso Gómez Date: Wed, 13 Nov 2019 13:44:12 +0100 Subject: #915 Test malformed payload for POST /wol This test covers requests that do not contain 1 of the parameters in their payloads. --- tests/units/test_0003_post_wol.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') diff --git a/tests/units/test_0003_post_wol.py b/tests/units/test_0003_post_wol.py index a1afe95..5c8c012 100644 --- a/tests/units/test_0003_post_wol.py +++ b/tests/units/test_0003_post_wol.py @@ -17,6 +17,15 @@ class TestPostWolMethods(unittest.TestCase): returned = requests.post(self.url, headers=self.headers, json=None) self.assertEqual(returned.status_code, 400) + def test_malformed_payload(self): + for parameter in self.json: + malformed_payload = self.json.copy() + malformed_payload.pop(parameter) + returned = requests.post(self.url, + headers=self.headers, + json=malformed_payload) + self.assertEqual(returned.status_code, 400) + def test_get(self): returned = requests.get(self.url, headers=self.headers) self.assertEqual(returned.status_code, 405) -- cgit v1.2.3-18-g5258