summaryrefslogtreecommitdiffstats
path: root/admin
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
commit5a54cec734c9c42c1a8f894e813177a8658f07c7 (patch)
treef0e3a4d6ab9dfd882237f5950c4324dc89d4f52a /admin
parentbbde0c133ce00d084bc909a53fe7faeb7953228a (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 'admin')
-rw-r--r--admin/Sources/Services/ogAdmServer/tests/units/test_0003_post_wol.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/admin/Sources/Services/ogAdmServer/tests/units/test_0003_post_wol.py b/admin/Sources/Services/ogAdmServer/tests/units/test_0003_post_wol.py
index a1afe95f..5c8c012a 100644
--- a/admin/Sources/Services/ogAdmServer/tests/units/test_0003_post_wol.py
+++ b/admin/Sources/Services/ogAdmServer/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)