You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.5 KiB
Python
40 lines
1.5 KiB
Python
# backend/tests/test_life_federation.py
|
|
def test_sub_pause_creates_high_risk_approval(client):
|
|
r = client.post("/api/life/subs/sub-netflix/pause", json={"paused": True}).json()
|
|
assert r["sub"]["paused"] is True
|
|
assert r["approval_id"] == "ap-life-sub-sub-netflix"
|
|
ap = client.get(f"/api/approvals/{r['approval_id']}").json()
|
|
assert ap["risk"] == "high" and ap["source"] == "life"
|
|
|
|
|
|
def test_sub_unpause(client):
|
|
client.post("/api/life/subs/sub-netflix/pause", json={"paused": True})
|
|
r = client.post("/api/life/subs/sub-netflix/pause", json={"paused": False}).json()
|
|
assert r["sub"]["paused"] is False and r["approval_id"] is None
|
|
|
|
|
|
def test_insight_act_routes_to_approval(client):
|
|
r = client.post("/api/life/insights/ins-netflix/act").json()
|
|
assert r["approval_id"] is not None and r["task_id"] is None
|
|
|
|
|
|
def test_insight_auto_transfer_creates_task(client):
|
|
r = client.post("/api/life/insights/ins-save/act").json()
|
|
assert r["task_id"] is not None
|
|
t = client.get(f"/api/tasks/{r['task_id']}").json()
|
|
assert "자동 이체" in t["title"]
|
|
|
|
|
|
def test_knowledge_suggest_calendar(client):
|
|
r = client.post(
|
|
"/api/life/knowledge/suggest/act", json={"item_id": "k4", "target": "calendar"}
|
|
).json()
|
|
assert r["event_id"] is not None
|
|
|
|
|
|
def test_knowledge_suggest_task(client):
|
|
r = client.post(
|
|
"/api/life/knowledge/suggest/act", json={"item_id": "k2", "target": "task"}
|
|
).json()
|
|
assert r["task_id"] is not None
|