summaryrefslogtreecommitdiffstats
path: root/unitest-restful.py
diff options
context:
space:
mode:
authorNicolargo <nicolas@nicolargo.com>2015-01-18 18:21:26 +0100
committerNicolargo <nicolas@nicolargo.com>2015-01-18 18:21:26 +0100
commit2d6675fa3bc419b1798dd7dcac53b0c72fc0b1a2 (patch)
tree25a262eb51ee6e72538b2494d202fd67d1dc2022 /unitest-restful.py
parent8a94bc65bb65ee56ec850de80b754e57dc620c0f (diff)
Add view (MVC speeking) for the plugins. Add API methods and Unitary test.
Diffstat (limited to 'unitest-restful.py')
-rwxr-xr-xunitest-restful.py39
1 files changed, 37 insertions, 2 deletions
diff --git a/unitest-restful.py b/unitest-restful.py
index 9b154e34..55fb5292 100755
--- a/unitest-restful.py
+++ b/unitest-restful.py
@@ -124,8 +124,6 @@ class TestGlances(unittest.TestCase):
plist = requests.get("%s/%s" % (URL, method))
- print(plist.json())
-
for p in plist.json():
print("HTTP RESTFul request: %s/%s" % (URL, p))
req = requests.get("%s/%s" % (URL, p))
@@ -175,6 +173,43 @@ class TestGlances(unittest.TestCase):
self.assertTrue(req.ok)
self.assertIsInstance(req.json(), types.DictType)
+ def test_007_all_views(self):
+ """All"""
+ method = "all/views"
+ print('INFO: [TEST_007] Get all views')
+
+ print("HTTP RESTFul request: %s/%s" % (URL, method))
+ req = requests.get("%s/%s" % (URL, method))
+
+ self.assertTrue(req.ok)
+ self.assertIsInstance(req.json(), types.DictType)
+
+ def test_008_plugins_limits(self):
+ """Plugins limits"""
+ method = "pluginslist"
+ print('INFO: [TEST_008] Plugins limits')
+
+ plist = requests.get("%s/%s" % (URL, method))
+
+ for p in plist.json():
+ print("HTTP RESTFul request: %s/%s/limits" % (URL, p))
+ req = requests.get("%s/%s/limits" % (URL, p))
+ self.assertTrue(req.ok)
+ self.assertIsInstance(req.json(), types.DictType)
+
+ def test_009_plugins_views(self):
+ """Plugins views"""
+ method = "pluginslist"
+ print('INFO: [TEST_009] Plugins views')
+
+ plist = requests.get("%s/%s" % (URL, method))
+
+ for p in plist.json():
+ print("HTTP RESTFul request: %s/%s/views" % (URL, p))
+ req = requests.get("%s/%s/views" % (URL, p))
+ self.assertTrue(req.ok)
+ self.assertIsInstance(req.json(), types.DictType)
+
def test_999_stop_server(self):
"""Stop the Glances Web Server"""
print('INFO: [TEST_999] Stop the Glances Web Server')