test_12_workbench.py 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. """§12 统一工作台"""
  2. import pytest
  3. pytestmark = pytest.mark.integration
  4. def test_workbench_and_notifications(api):
  5. home = api.assert_success(api.get("/workbench", params={"role": "manager"}))
  6. assert isinstance(home, dict)
  7. notifs = api.assert_success(api.get("/notifications"))
  8. assert isinstance(notifs, list)
  9. tpl = api.assert_success(
  10. api.get(
  11. "/notifications/template",
  12. params={"issueType": "missing_doc", "roomName": "测试群"},
  13. )
  14. )
  15. assert isinstance(tpl, dict)
  16. sent = api.assert_success(
  17. api.post(
  18. "/notifications/send",
  19. json={
  20. "type": "compliance",
  21. "receiverId": 1,
  22. "title": "pytest 通知",
  23. "content": "测试内容",
  24. "refId": 1,
  25. },
  26. ),
  27. status=201,
  28. )
  29. assert sent is not None
  30. logs = api.assert_success(api.get("/audit-logs", params={"limit": 20}))
  31. assert isinstance(logs, list)