diff options
author | nicolargo <nicolas@nicolargo.com> | 2023-12-23 11:10:52 +0100 |
---|---|---|
committer | nicolargo <nicolas@nicolargo.com> | 2023-12-23 11:10:52 +0100 |
commit | fa0fc8578ef590792db604b6366071fad719ffa5 (patch) | |
tree | 9b6a39001def83d874f66b431bbe350870dcb620 | |
parent | 254c7df946ba8a9a4f5444be5b19efc5bbabb586 (diff) |
Add unittest (API) for fields description and unit
-rwxr-xr-x | unitest-restful.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/unitest-restful.py b/unitest-restful.py index 08f7c27f..faf1fe8f 100755 --- a/unitest-restful.py +++ b/unitest-restful.py @@ -257,6 +257,20 @@ class TestGlances(unittest.TestCase): self.assertTrue(req.headers['Content-Encoding'] == 'gzip') self.assertTrue(req.json(), dict) + def test_016_fields_description(self): + """Fields description.""" + print('INFO: [TEST_016] Get fields description and unit') + + print("HTTP RESTful request: %s/cpu/total/description" % URL) + req = self.http_get("%s/cpu/total/description" % URL) + self.assertTrue(req.ok) + self.assertTrue(req.json(), str) + + print("HTTP RESTful request: %s/cpu/total/unit" % URL) + req = self.http_get("%s/cpu/total/unit" % URL) + self.assertTrue(req.ok) + self.assertTrue(req.json(), str) + def test_999_stop_server(self): """Stop the Glances Web Server.""" print('INFO: [TEST_999] Stop the Glances Web Server') |