Files
sciagent/be0/tests/test_application_drafts_get.py
Thinh Lam 688fac73e9
CI/CD / backend (push) Failing after 2m8s
CI/CD / frontend (push) Failing after 1m40s
CI/CD / deploy (push) Has been skipped
sciagent code + Gitea Actions CI/CD
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 09:38:30 +07:00

34 lines
1001 B
Python

"""
QA: GET draft bundle returns 200 with empty tabs when nothing is stored yet.
Run: cd be0 && python -m unittest tests.test_application_drafts_get -v
"""
from __future__ import annotations
import unittest
from unittest.mock import patch
_CASE = "CASE-1776577845956"
class ApplicationDraftsGetTests(unittest.TestCase):
@patch("src.initiative_db.engine.is_postgres_enabled", return_value=False)
@patch("main._load_application_draft_yaml", return_value=None)
def test_unknown_case_returns_200_empty_shape(self, _mock_yaml, _mock_pg) -> None:
from fastapi.testclient import TestClient
from main import app
client = TestClient(app)
r = client.get(f"/api/v1/application-drafts/{_CASE}")
self.assertEqual(r.status_code, 200, r.text)
body = r.json()
self.assertEqual(body.get("caseId"), _CASE)
self.assertEqual(body.get("tabs"), {})
self.assertIn("updatedAt", body)
if __name__ == "__main__":
unittest.main()