summaryrefslogtreecommitdiffstats
path: root/tests/units
diff options
context:
space:
mode:
authorRoberto Hueso Gómez <rhueso@soleta.eu>2019-11-13 13:44:12 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2019-11-13 14:16:01 +0100
commit682d3b6b17f4b60aab7f804789146ac8af84b071 (patch)
tree627a93b95e4cd67840e006bc1cb029ff1cf0994c /tests/units
parent4d98bdf5f6fb555c13432fbae4d58ce539854487 (diff)
#915 Test malformed payload for POST /wol
This test covers requests that do not contain 1 of the parameters in their payloads.
Diffstat (limited to 'tests/units')
-rw-r--r--tests/units/test_0003_post_wol.py9
1 files changed, 9 insertions, 0 deletions
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)