Skip to content

Commit

Permalink
Add unittest (API) for fields description and unit
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolargo committed Dec 23, 2023
1 parent 254c7df commit fa0fc85
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions unitest-restful.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,20 @@ def test_015_all_gzip(self):
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')
Expand Down

0 comments on commit fa0fc85

Please sign in to comment.