fix: Bottle - /api/%s/status endpoint

prob: failure in compressing `None` with zlib
This commit is contained in:
Raz Crimson 2023-03-10 19:05:24 +05:30
parent d3bc9061f4
commit 53c1d64aff
2 changed files with 11 additions and 1 deletions

View File

@ -230,7 +230,7 @@ class GlancesBottle(object):
"""
response.status = 200
return None
return "Active"
@compress
def _api_help(self):

View File

@ -221,6 +221,16 @@ class TestGlances(unittest.TestCase):
self.assertIsInstance(req.json(), dict)
self.assertIsInstance(req.json()['interface_name'], list)
def test_012_status(self):
"""Check status endpoint."""
method = "status"
print('INFO: [TEST_012] Status')
print("HTTP RESTful request: %s/%s" % (URL, method))
req = self.http_get("%s/%s" % (URL, method))
self.assertTrue(req.ok)
self.assertEqual(req.text, "Active")
def test_999_stop_server(self):
"""Stop the Glances Web Server."""
print('INFO: [TEST_999] Stop the Glances Web Server')