summaryrefslogtreecommitdiffstats
path: root/tests/units/0003-post-wol.py
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
commit556aa6b858ac1c5bf5d6ef39448dd69e56798fb2 (patch)
tree5e871218522dd781edb88eeb82c2683e484d704c /tests/units/0003-post-wol.py
parentc39b1f324ea5f2f01d1e455da6140606e89213c3 (diff)
#915 add test for POST /wol REST API
Diffstat (limited to 'tests/units/0003-post-wol.py')
-rw-r--r--tests/units/0003-post-wol.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/units/0003-post-wol.py b/tests/units/0003-post-wol.py
new file mode 100644
index 0000000..686cb37
--- /dev/null
+++ b/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()