summaryrefslogtreecommitdiffstats
path: root/tests/units
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2019-05-30 18:13:42 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2019-05-31 11:39:43 +0200
commitb35438d27e00ec63d68018268c2733ec14c39e00 (patch)
treed5016fede59a217951cd4cf1c825a0cd167815bc /tests/units
parent496f5ebb49376e9ad65fceec9cb6ed602900d357 (diff)
#915 add test for POST /session REST API
Diffstat (limited to 'tests/units')
-rw-r--r--tests/units/0006-post-session.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/units/0006-post-session.py b/tests/units/0006-post-session.py
new file mode 100644
index 0000000..0a36015
--- /dev/null
+++ b/tests/units/0006-post-session.py
@@ -0,0 +1,20 @@
+import requests
+import unittest
+
+class TestPostSessionMethods(unittest.TestCase):
+
+ def setUp(self):
+ self.url = 'http://localhost:8888/shell/run'
+ self.json = { 'clients' : [ '192.168.2.1', '192.168.2.2' ],
+ 'disk' : '0', 'partition' : '1'}
+
+ 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()