diff options
author | Roberto Hueso Gómez <rhueso@soleta.eu> | 2019-11-13 12:57:57 +0100 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2019-11-13 14:15:56 +0100 |
commit | 65cc7c17e231ed10b93dce6e0e8e998f66ba0212 (patch) | |
tree | dfa7c41c68dc98612fc4c2b5e1a618a32a63d5fb /tests | |
parent | 6c91d147c1c31a7fa78f2721e1c963500a49084d (diff) |
#915 Extend REST API POST no payload tests to all remaining tests.
This patch extends tests for requests without any payload in the following REST
API POST functions:
- /clients
- /wol
- /shell/run
- /shell/output
- /session
- /poweroff
- /reboot
- /stop
- /refresh
- /hardware
- /software
Diffstat (limited to 'tests')
-rw-r--r-- | tests/units/test_0002_post_clients.py | 4 | ||||
-rw-r--r-- | tests/units/test_0003_post_wol.py | 4 | ||||
-rw-r--r-- | tests/units/test_0004_post_shell_run.py | 4 | ||||
-rw-r--r-- | tests/units/test_0005_post_shell_output.py | 4 | ||||
-rw-r--r-- | tests/units/test_0006_post_session.py | 4 | ||||
-rw-r--r-- | tests/units/test_0007_post_poweroff.py | 4 | ||||
-rw-r--r-- | tests/units/test_0008_post_reboot.py | 4 | ||||
-rw-r--r-- | tests/units/test_0009_post_stop.py | 4 | ||||
-rw-r--r-- | tests/units/test_0010_post_refresh.py | 4 | ||||
-rw-r--r-- | tests/units/test_0011_post_hardware.py | 4 | ||||
-rw-r--r-- | tests/units/test_0012_post_software.py | 4 |
11 files changed, 44 insertions, 0 deletions
diff --git a/tests/units/test_0002_post_clients.py b/tests/units/test_0002_post_clients.py index 1aae349..590d6ba 100644 --- a/tests/units/test_0002_post_clients.py +++ b/tests/units/test_0002_post_clients.py @@ -12,5 +12,9 @@ class TestPostClientsMethods(unittest.TestCase): returned = requests.post(self.url, headers=self.headers, json=self.json) self.assertEqual(returned.status_code, 200) + def test_no_payload(self): + returned = requests.post(self.url, headers=self.headers, json=None) + self.assertEqual(returned.status_code, 400) + if __name__ == '__main__': unittest.main() diff --git a/tests/units/test_0003_post_wol.py b/tests/units/test_0003_post_wol.py index e997aff..a1afe95 100644 --- a/tests/units/test_0003_post_wol.py +++ b/tests/units/test_0003_post_wol.py @@ -13,6 +13,10 @@ class TestPostWolMethods(unittest.TestCase): returned = requests.post(self.url, headers=self.headers, json=self.json) self.assertEqual(returned.status_code, 200) + def test_no_payload(self): + returned = requests.post(self.url, headers=self.headers, json=None) + self.assertEqual(returned.status_code, 400) + def test_get(self): returned = requests.get(self.url, headers=self.headers) self.assertEqual(returned.status_code, 405) diff --git a/tests/units/test_0004_post_shell_run.py b/tests/units/test_0004_post_shell_run.py index 0dd03c1..929565c 100644 --- a/tests/units/test_0004_post_shell_run.py +++ b/tests/units/test_0004_post_shell_run.py @@ -14,6 +14,10 @@ class TestPostShellRunMethods(unittest.TestCase): returned = requests.post(self.url, headers=self.headers, json=self.json) self.assertEqual(returned.status_code, 200) + def test_no_payload(self): + returned = requests.post(self.url, headers=self.headers, json=None) + self.assertEqual(returned.status_code, 400) + def test_get(self): returned = requests.get(self.url, headers=self.headers) self.assertEqual(returned.status_code, 405) diff --git a/tests/units/test_0005_post_shell_output.py b/tests/units/test_0005_post_shell_output.py index 1c6f7a3..ea44ab6 100644 --- a/tests/units/test_0005_post_shell_output.py +++ b/tests/units/test_0005_post_shell_output.py @@ -12,6 +12,10 @@ class TestPostShellOutputMethods(unittest.TestCase): returned = requests.post(self.url, headers=self.headers, json=self.json) self.assertEqual(returned.status_code, 200) + def test_no_payload(self): + returned = requests.post(self.url, headers=self.headers, json=None) + self.assertEqual(returned.status_code, 400) + def test_get(self): returned = requests.get(self.url, headers=self.headers) self.assertEqual(returned.status_code, 405) diff --git a/tests/units/test_0006_post_session.py b/tests/units/test_0006_post_session.py index 544ae2a..95e181a 100644 --- a/tests/units/test_0006_post_session.py +++ b/tests/units/test_0006_post_session.py @@ -13,6 +13,10 @@ class TestPostSessionMethods(unittest.TestCase): returned = requests.post(self.url, headers=self.headers, json=self.json) self.assertEqual(returned.status_code, 200) + def test_no_payload(self): + returned = requests.post(self.url, headers=self.headers, json=None) + self.assertEqual(returned.status_code, 400) + def test_get(self): returned = requests.get(self.url, headers=self.headers) self.assertEqual(returned.status_code, 405) diff --git a/tests/units/test_0007_post_poweroff.py b/tests/units/test_0007_post_poweroff.py index d2d5b15..bbf9bf9 100644 --- a/tests/units/test_0007_post_poweroff.py +++ b/tests/units/test_0007_post_poweroff.py @@ -12,6 +12,10 @@ class TestPostPoweroffMethods(unittest.TestCase): returned = requests.post(self.url, headers=self.headers, json=self.json) self.assertEqual(returned.status_code, 200) + def test_no_payload(self): + returned = requests.post(self.url, headers=self.headers, json=None) + self.assertEqual(returned.status_code, 400) + def test_get(self): returned = requests.get(self.url, headers=self.headers) self.assertEqual(returned.status_code, 405) diff --git a/tests/units/test_0008_post_reboot.py b/tests/units/test_0008_post_reboot.py index 5ac4dc2..5d4ae06 100644 --- a/tests/units/test_0008_post_reboot.py +++ b/tests/units/test_0008_post_reboot.py @@ -12,6 +12,10 @@ class TestPostRebootMethods(unittest.TestCase): returned = requests.post(self.url, headers=self.headers, json=self.json) self.assertEqual(returned.status_code, 200) + def test_no_payload(self): + returned = requests.post(self.url, headers=self.headers, json=None) + self.assertEqual(returned.status_code, 400) + def test_get(self): returned = requests.get(self.url, headers=self.headers) self.assertEqual(returned.status_code, 405) diff --git a/tests/units/test_0009_post_stop.py b/tests/units/test_0009_post_stop.py index 7aa96ff..4f6e2bf 100644 --- a/tests/units/test_0009_post_stop.py +++ b/tests/units/test_0009_post_stop.py @@ -12,6 +12,10 @@ class TestPostStopMethods(unittest.TestCase): returned = requests.post(self.url, headers=self.headers, json=self.json) self.assertEqual(returned.status_code, 200) + def test_no_payload(self): + returned = requests.post(self.url, headers=self.headers, json=None) + self.assertEqual(returned.status_code, 400) + def test_get(self): returned = requests.get(self.url, headers=self.headers) self.assertEqual(returned.status_code, 405) diff --git a/tests/units/test_0010_post_refresh.py b/tests/units/test_0010_post_refresh.py index 745bdbe..5d4dc81 100644 --- a/tests/units/test_0010_post_refresh.py +++ b/tests/units/test_0010_post_refresh.py @@ -12,6 +12,10 @@ class TestPostRefreshMethods(unittest.TestCase): returned = requests.post(self.url, headers=self.headers, json=self.json) self.assertEqual(returned.status_code, 200) + def test_no_payload(self): + returned = requests.post(self.url, headers=self.headers, json=None) + self.assertEqual(returned.status_code, 400) + def test_get(self): returned = requests.get(self.url, headers=self.headers) self.assertEqual(returned.status_code, 405) diff --git a/tests/units/test_0011_post_hardware.py b/tests/units/test_0011_post_hardware.py index 6d9c16a..1a620d1 100644 --- a/tests/units/test_0011_post_hardware.py +++ b/tests/units/test_0011_post_hardware.py @@ -12,6 +12,10 @@ class TestPostHardwareMethods(unittest.TestCase): returned = requests.post(self.url, headers=self.headers, json=self.json) self.assertEqual(returned.status_code, 200) + def test_no_payload(self): + returned = requests.post(self.url, headers=self.headers, json=None) + self.assertEqual(returned.status_code, 400) + def test_get(self): returned = requests.get(self.url, headers=self.headers) self.assertEqual(returned.status_code, 405) diff --git a/tests/units/test_0012_post_software.py b/tests/units/test_0012_post_software.py index 1b41a86..1574683 100644 --- a/tests/units/test_0012_post_software.py +++ b/tests/units/test_0012_post_software.py @@ -14,6 +14,10 @@ class TestPostSoftwareMethods(unittest.TestCase): returned = requests.post(self.url, headers=self.headers, json=self.json) self.assertEqual(returned.status_code, 200) + def test_no_payload(self): + returned = requests.post(self.url, headers=self.headers, json=None) + self.assertEqual(returned.status_code, 400) + def test_get(self): returned = requests.get(self.url, headers=self.headers) self.assertEqual(returned.status_code, 405) |