Merge remote-tracking branch 'origin/sub_laptop_3' into sub_laptop_2
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
"""M01 조합 알약(`GET /api/m01/combo/{키}/inputs`) — 담은 로직 결과단위 분모가 물량 하나.
|
||||
|
||||
못박는 것
|
||||
- 물량 = 로직 결과단위 분모(원/㎥ → ㎥) · 설계 조건(고르기 · 범위)은 안 넣음(`조건` 은 빈 자리).
|
||||
- 이름 = 로직 이름 끝 괄호 뗀 것 · 같은 이름 · 단위면 한 알약(로직 여럿).
|
||||
- 원/10㎡ 는 단위 ㎡ · `배` 10 · 없는 조합 404.
|
||||
정본 파일을 읽기만 함.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
from fastapi import FastAPI
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from M01_MasterData import M01_MasterData_Router as router_module
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def client() -> TestClient:
|
||||
app = FastAPI()
|
||||
app.include_router(router_module.router)
|
||||
return TestClient(app)
|
||||
|
||||
|
||||
def _pills(client: TestClient, key: str) -> dict:
|
||||
res = client.get(f"/api/m01/combo/{key}/inputs")
|
||||
assert res.status_code == 200, res.text
|
||||
return res.json()
|
||||
|
||||
|
||||
def test_기슭막이_찰쌓기_인력_장비는_한_알약(client) -> None:
|
||||
got = _pills(client, "UA000004")
|
||||
assert got["조건"] == []
|
||||
by = {(p["이름"], p["단위"]): p for p in got["물량"]}
|
||||
assert len(got["물량"]) == 10 # 담은 로직 11 · 찰쌓기 둘이 합침
|
||||
assert by[("돌쌓기 찰쌓기", "㎡")]["로직"] == ["GF000222", "GF000221"]
|
||||
assert by[("레디믹스트콘크리트 타설", "㎥")]["로직"] == ["GC000198"]
|
||||
assert by[("유로폼 설치 및 해체", "㎡")]["키"] == "GC000214"
|
||||
assert set(got["물량"][0]) == {"키", "이름", "단위", "로직"}
|
||||
|
||||
|
||||
def test_원_10제곱미터는_배_10(client) -> None:
|
||||
got = _pills(client, "UA000031")
|
||||
pill = next(p for p in got["물량"] if p["키"] == "GF000226")
|
||||
assert (pill["단위"], pill["배"]) == ("㎡", 10)
|
||||
|
||||
|
||||
def test_준공표지석_물량_여섯(client) -> None:
|
||||
got = _pills(client, "UA000002")
|
||||
assert [p["단위"] for p in got["물량"]] == ["㎥", "㎡", "㎥", "㎥", "㎥", "㎡"]
|
||||
|
||||
|
||||
def test_없는_조합은_404(client) -> None:
|
||||
assert client.get("/api/m01/combo/UA999999/inputs").status_code == 404
|
||||
Reference in New Issue
Block a user