25 lines
786 B
Python
25 lines
786 B
Python
from __future__ import annotations
|
|
|
|
import unittest
|
|
|
|
from backend.jobs.service import _verified_dashboard_result
|
|
|
|
|
|
class AdminRefreshStatusTests(unittest.TestCase):
|
|
def test_carried_snapshot_is_reported_as_failed_job(self):
|
|
result = _verified_dashboard_result(
|
|
{"meta": {"carried_forward": True, "notice": "官方涨跌停数据尚未返回"}}
|
|
)
|
|
|
|
self.assertEqual(result["status"], "failed")
|
|
self.assertEqual(result["error"], "官方涨跌停数据尚未返回")
|
|
|
|
def test_current_snapshot_is_reported_as_successful_job(self):
|
|
dashboard = {"meta": {"trade_date": "2026-08-28", "carried_forward": False}}
|
|
|
|
self.assertIs(_verified_dashboard_result(dashboard), dashboard)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|