forked from luopingyi/xc_agent_platform_demo
live: success = verify_pass (verifyResult==1); per-cycle [live] stats line; /status stats + success_metric (76 tests)
This commit is contained in:
@@ -58,3 +58,18 @@ class TestHealth(unittest.TestCase):
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
|
||||
class TestStatsStatus(unittest.TestCase):
|
||||
def test_status_stats_and_metric(self):
|
||||
from src.live_queue import compute_stats
|
||||
stats = dict(compute_stats([]), updated_at=123.0)
|
||||
for snapshot in (None, stats):
|
||||
with mock.patch('src.health.last_stats', return_value=snapshot):
|
||||
code, _, body = handle_get('/status')
|
||||
self.assertEqual(code, 200)
|
||||
payload = json.loads(body)
|
||||
self.assertEqual(payload['stats'], snapshot)
|
||||
self.assertEqual(payload['success_metric'], 'verify_pass')
|
||||
self.assertIn('strategy_id_present', payload)
|
||||
self.assertIn('external_service_token_present', payload)
|
||||
|
||||
Reference in New Issue
Block a user