diff options
author | Roberto Hueso Gómez <rhueso@soleta.eu> | 2019-11-13 13:45:37 +0100 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2019-11-13 14:16:02 +0100 |
commit | 394ba0950a9ecd694db572083723ee4422d8aaf4 (patch) | |
tree | 7b658ba1d650e3f7651bcb611f3c7c863b5f78d5 | |
parent | 5a54cec734c9c42c1a8f894e813177a8658f07c7 (diff) |
#915 Test malformed payload for POST /shell/run
This test covers requests that do not contain 1 of the parameters in their
payloads.
-rw-r--r-- | admin/Sources/Services/ogAdmServer/tests/units/test_0004_post_shell_run.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/admin/Sources/Services/ogAdmServer/tests/units/test_0004_post_shell_run.py b/admin/Sources/Services/ogAdmServer/tests/units/test_0004_post_shell_run.py index 929565cc..11779da4 100644 --- a/admin/Sources/Services/ogAdmServer/tests/units/test_0004_post_shell_run.py +++ b/admin/Sources/Services/ogAdmServer/tests/units/test_0004_post_shell_run.py @@ -18,6 +18,15 @@ class TestPostShellRunMethods(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) |