summaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2019-05-30 18:12:57 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2019-05-31 11:39:01 +0200
commit78236f8abf20f304899eddba27d728069c10706f (patch)
tree892509f6ec86798439cc0310d0fa85b01e0cbd50 /admin
parenta4ec92b7918a9a5273ad5e0263c52b5a513470fc (diff)
#915 add test for POST /wol REST API
Diffstat (limited to 'admin')
-rw-r--r--admin/Sources/Services/ogAdmServer/tests/units/0003-post-wol.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/admin/Sources/Services/ogAdmServer/tests/units/0003-post-wol.py b/admin/Sources/Services/ogAdmServer/tests/units/0003-post-wol.py
new file mode 100644
index 00000000..686cb375
--- /dev/null
+++ b/admin/Sources/Services/ogAdmServer/tests/units/0003-post-wol.py
@@ -0,0 +1,20 @@
+import requests
+import unittest
+
+class TestPostWolMethods(unittest.TestCase):
+
+ def setUp(self):
+ self.url = 'http://localhost:8888/wol'
+ self.json = { 'type' : 'broadcast', 'clients' : { 'addr' : '192.168.2.1',
+ 'mac' : '00AABBCCDD01' } }
+
+ def test_post(self):
+ returned = requests.post(self.url, json=self.json)
+ self.assertEqual(returned.status_code, 200)
+
+ def test_get(self):
+ returned = requests.post(self.url)
+ self.assertEqual(returned.status_code, 404)
+
+if __name__ == '__main__':
+ unittest.main()