summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2019-07-09 12:05:51 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2019-07-15 09:49:51 +0200
commitec0fd6d4edf363f4c26843d4b460cc6ae47c91b0 (patch)
treebe8a54be21a382a3f48da65aac86c2650752ad87
parentec85645c9a73aa9dde6246522e5d417d2b8ad97c (diff)
#915 adds test for POST /reboot REST API
This test covers two two scenarios: 1. Correct usage. 2. Incorrect usage, use this command with GET (this returns http 405).
-rw-r--r--admin/Sources/Services/ogAdmServer/tests/units/test_0008_post_reboot.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/admin/Sources/Services/ogAdmServer/tests/units/test_0008_post_reboot.py b/admin/Sources/Services/ogAdmServer/tests/units/test_0008_post_reboot.py
new file mode 100644
index 00000000..5ac4dc24
--- /dev/null
+++ b/admin/Sources/Services/ogAdmServer/tests/units/test_0008_post_reboot.py
@@ -0,0 +1,20 @@
+import requests
+import unittest
+
+class TestPostRebootMethods(unittest.TestCase):
+
+ def setUp(self):
+ self.url = 'http://localhost:8888/reboot'
+ self.headers = {'Authorization' : '07b3bfe728954619b58f0107ad73acc1'}
+ self.json = { 'clients' : [ '192.168.2.1', '192.168.2.2' ] }
+
+ def test_post(self):
+ returned = requests.post(self.url, headers=self.headers, json=self.json)
+ self.assertEqual(returned.status_code, 200)
+
+ def test_get(self):
+ returned = requests.get(self.url, headers=self.headers)
+ self.assertEqual(returned.status_code, 405)
+
+if __name__ == '__main__':
+ unittest.main()