summaryrefslogtreecommitdiffstats
path: root/unitest-restful.py
diff options
context:
space:
mode:
authornicolargo <nicolas@nicolargo.com>2023-08-14 10:30:20 +0200
committernicolargo <nicolas@nicolargo.com>2023-08-14 10:30:20 +0200
commitef2f949f04808613a459fa8739fc685304df4097 (patch)
treeff716162a1b845900b3edca870a3b63daa732975 /unitest-restful.py
parentc5e11cef5960ee13289c10c615e2d2034a1aede4 (diff)
Implement a new API method to limit the number of returned list object #2491
Diffstat (limited to 'unitest-restful.py')
-rwxr-xr-xunitest-restful.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/unitest-restful.py b/unitest-restful.py
index a697ff78..17e734e1 100755
--- a/unitest-restful.py
+++ b/unitest-restful.py
@@ -231,6 +231,18 @@ class TestGlances(unittest.TestCase):
self.assertTrue(req.ok)
self.assertEqual(req.text, "Active")
+ def test_013_top(self):
+ """Values."""
+ method = "processlist"
+ request = "%s/%s/top/2" % (URL, method)
+ print('INFO: [TEST_013] Top nb item of PROCESSLIST')
+ print(request)
+ req = self.http_get(request)
+
+ self.assertTrue(req.ok)
+ self.assertIsInstance(req.json(), list)
+ self.assertEqual(len(req.json()), 2)
+
def test_999_stop_server(self):
"""Stop the Glances Web Server."""
print('INFO: [TEST_999] Stop the Glances Web Server')