- 원인: B07 단건 조회가 계획평면도(plan_*)는 파생 저장본(508-3c) 길로 모델 대신 날 JSON Response 를 돌려줌 · B09 는 .drawing 속성만 보고 오류로 침 - 고침: 200 · application/json Response 면 본문 JSON 을 그대로 읽음 · 오류 응답은 그대로 400 글 - 지킴 시험 test_543_print_plan_stored_copy (저장본 Response 읽음 · 오류 응답 읽지 못함) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
"""B09 인쇄 도면 — B07 계획평면도 파생 저장본(Response JSON 그대로)도 읽음 · 오류 응답은 400 글."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import asyncio
|
|
import json
|
|
from uuid import uuid4
|
|
|
|
import pytest
|
|
from fastapi import Response
|
|
from fastapi.responses import JSONResponse
|
|
|
|
from B07_DesignDetail import B07_DesignDetail_Router as b07
|
|
from B09_Estimation.draft import B09_Draft_Print_Drawings_Source as source
|
|
|
|
DRAWING = {"entities": [{"type": "Line"}], "layers": []}
|
|
|
|
|
|
def _read(monkeypatch, response):
|
|
async def fake(project_id, drawing_id):
|
|
return response
|
|
|
|
monkeypatch.setattr(b07, "get_design_drawing", fake)
|
|
return asyncio.run(source.b07_drawing(uuid4(), "plan_terrain"))
|
|
|
|
|
|
def test_저장본_Response_JSON_을_읽음(monkeypatch):
|
|
body = json.dumps({"id": "plan_terrain", "drawing": DRAWING, "confirmed": False})
|
|
got = _read(monkeypatch, Response(content=body.encode(), media_type="application/json"))
|
|
assert got["drawing"] == DRAWING and got["confirmed"] is False
|
|
|
|
|
|
def test_오류_응답은_읽지_못함(monkeypatch):
|
|
with pytest.raises(ValueError, match="plan_terrain"):
|
|
_read(monkeypatch, JSONResponse(status_code=404, content={"message": "없음"}))
|