Add unittest (API) for fields description and unit

pull/2572/head
nicolargo 2023-12-23 11:10:52 +01:00
parent 254c7df946
commit fa0fc8578e
1 changed files with 14 additions and 0 deletions

View File

@ -257,6 +257,20 @@ class TestGlances(unittest.TestCase):
self.assertTrue(req.headers['Content-Encoding'] == 'gzip') self.assertTrue(req.headers['Content-Encoding'] == 'gzip')
self.assertTrue(req.json(), dict) 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): def test_999_stop_server(self):
"""Stop the Glances Web Server.""" """Stop the Glances Web Server."""
print('INFO: [TEST_999] Stop the Glances Web Server') print('INFO: [TEST_999] Stop the Glances Web Server')