diff options
author | Roberto Hueso Gómez <rhueso@soleta.eu> | 2019-11-14 10:49:48 +0100 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2019-11-14 14:51:13 +0100 |
commit | abd2b913d8b352388eb093f0e03b67138db9c490 (patch) | |
tree | f04b45e644dd1856382b5758d601d143fa77a81e /tests/units/test_0020_post_image_create_incremental.py | |
parent | 1cdbc5facf0055c4996e4da9457299b0280baf58 (diff) |
#915 Test malformed payload for POST commands
This patch includes tests for the remaining REST API commands:
POST /shell/output
POST /session
POST /poweroff
POST /reboot
POST /stop
POST /refresh
POST /hardware
POST /software
POST /image/create
POST /image/restore
POST /setup
POST /image/create/basic
POST /image/create/incremental
POST /image/restore/basic
POST /image/restore/incremental
POST /run/schedule
This test covers requests that are missing one of the parameters in its
payload.
Diffstat (limited to 'tests/units/test_0020_post_image_create_incremental.py')
-rw-r--r-- | tests/units/test_0020_post_image_create_incremental.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/units/test_0020_post_image_create_incremental.py b/tests/units/test_0020_post_image_create_incremental.py index bf17979..c677e27 100644 --- a/tests/units/test_0020_post_image_create_incremental.py +++ b/tests/units/test_0020_post_image_create_incremental.py @@ -32,6 +32,15 @@ class TestPostCreateIncrementalImageMethods(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) |