summaryrefslogtreecommitdiffstats
path: root/tests/units/test_0019_post_run_schedule.py
diff options
context:
space:
mode:
authorIsabel Arrans <isabelarrans@gmail.com>2020-10-23 18:55:17 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2020-10-24 12:53:11 +0200
commitb11608152e9e2a9af32e15a100d3d034222ad3e4 (patch)
tree6148a685b287b0ea752019a73d85a224b1889917 /tests/units/test_0019_post_run_schedule.py
parentb0d18cd887f654cd4b607655ab3370e00eb656ec (diff)
#915 restore more tests
Diffstat (limited to 'tests/units/test_0019_post_run_schedule.py')
-rw-r--r--tests/units/test_0019_post_run_schedule.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/units/test_0019_post_run_schedule.py b/tests/units/test_0019_post_run_schedule.py
new file mode 100644
index 0000000..3b92304
--- /dev/null
+++ b/tests/units/test_0019_post_run_schedule.py
@@ -0,0 +1,28 @@
+import requests
+import unittest
+
+class TestPostRunScheduleMethods(unittest.TestCase):
+
+ def setUp(self):
+ self.url = 'http://localhost:8888/run/schedule'
+ 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_no_payload(self):
+ returned = requests.post(self.url, headers=self.headers, json=None)
+ self.assertEqual(returned.status_code, 400)
+
+ def test_malformed_payload(self):
+ returned = requests.post(self.url, headers=self.headers, json={})
+ self.assertEqual(returned.status_code, 400)
+
+ def test_get(self):
+ returned = requests.get(self.url, headers=self.headers)
+ self.assertEqual(returned.status_code, 405)
+
+if __name__ == '__main__':
+ unittest.main()