feat: add Resolution and Next Steps sections to all export formats
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1058,3 +1058,129 @@ class TestSessions:
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.json()["next_steps"] == "Schedule follow-up call"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_export_includes_outcome_notes_in_resolution(
|
||||
self, client: AsyncClient, auth_headers: dict, test_tree: dict
|
||||
):
|
||||
"""Test that outcome_notes appear as Resolution section in exports."""
|
||||
create_response = await client.post(
|
||||
"/api/v1/sessions",
|
||||
json={"tree_id": test_tree["id"]},
|
||||
headers=auth_headers
|
||||
)
|
||||
session_id = create_response.json()["id"]
|
||||
|
||||
await client.post(
|
||||
f"/api/v1/sessions/{session_id}/complete",
|
||||
json={
|
||||
"outcome": "resolved",
|
||||
"outcome_notes": "Replaced failed DIMM in slot A2",
|
||||
"next_steps": "Monitor for 24 hours"
|
||||
},
|
||||
headers=auth_headers
|
||||
)
|
||||
|
||||
# Test markdown
|
||||
response = await client.post(
|
||||
f"/api/v1/sessions/{session_id}/export",
|
||||
json={"format": "markdown"},
|
||||
headers=auth_headers
|
||||
)
|
||||
assert response.status_code == 200
|
||||
content = response.text
|
||||
assert "## Resolution" in content
|
||||
assert "Replaced failed DIMM in slot A2" in content
|
||||
assert "## Next Steps" in content
|
||||
assert "Monitor for 24 hours" in content
|
||||
|
||||
# Test text
|
||||
response = await client.post(
|
||||
f"/api/v1/sessions/{session_id}/export",
|
||||
json={"format": "text"},
|
||||
headers=auth_headers
|
||||
)
|
||||
content = response.text
|
||||
assert "RESOLUTION" in content
|
||||
assert "Replaced failed DIMM in slot A2" in content
|
||||
assert "NEXT STEPS" in content
|
||||
assert "Monitor for 24 hours" in content
|
||||
|
||||
# Test HTML
|
||||
response = await client.post(
|
||||
f"/api/v1/sessions/{session_id}/export",
|
||||
json={"format": "html"},
|
||||
headers=auth_headers
|
||||
)
|
||||
content = response.text
|
||||
assert "Resolution" in content
|
||||
assert "Replaced failed DIMM in slot A2" in content
|
||||
assert "Next Steps" in content
|
||||
assert "Monitor for 24 hours" in content
|
||||
|
||||
# Test PSA
|
||||
response = await client.post(
|
||||
f"/api/v1/sessions/{session_id}/export",
|
||||
json={"format": "psa"},
|
||||
headers=auth_headers
|
||||
)
|
||||
content = response.text
|
||||
assert "Replaced failed DIMM in slot A2" in content
|
||||
assert "Monitor for 24 hours" in content
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_export_omits_empty_resolution_and_next_steps(
|
||||
self, client: AsyncClient, auth_headers: dict, test_tree: dict
|
||||
):
|
||||
"""Test that empty outcome_notes/next_steps don't create empty sections."""
|
||||
create_response = await client.post(
|
||||
"/api/v1/sessions",
|
||||
json={"tree_id": test_tree["id"]},
|
||||
headers=auth_headers
|
||||
)
|
||||
session_id = create_response.json()["id"]
|
||||
|
||||
await client.post(
|
||||
f"/api/v1/sessions/{session_id}/complete",
|
||||
json={"outcome": "resolved"},
|
||||
headers=auth_headers
|
||||
)
|
||||
|
||||
response = await client.post(
|
||||
f"/api/v1/sessions/{session_id}/export",
|
||||
json={"format": "markdown"},
|
||||
headers=auth_headers
|
||||
)
|
||||
content = response.text
|
||||
assert "## Resolution" not in content
|
||||
assert "## Next Steps" not in content
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_export_exclude_outcome_notes_flag(
|
||||
self, client: AsyncClient, auth_headers: dict, test_tree: dict
|
||||
):
|
||||
"""Test include_outcome_notes=False suppresses resolution section."""
|
||||
create_response = await client.post(
|
||||
"/api/v1/sessions",
|
||||
json={"tree_id": test_tree["id"]},
|
||||
headers=auth_headers
|
||||
)
|
||||
session_id = create_response.json()["id"]
|
||||
|
||||
await client.post(
|
||||
f"/api/v1/sessions/{session_id}/complete",
|
||||
json={
|
||||
"outcome": "resolved",
|
||||
"outcome_notes": "Should not appear"
|
||||
},
|
||||
headers=auth_headers
|
||||
)
|
||||
|
||||
response = await client.post(
|
||||
f"/api/v1/sessions/{session_id}/export",
|
||||
json={"format": "markdown", "include_outcome_notes": False},
|
||||
headers=auth_headers
|
||||
)
|
||||
content = response.text
|
||||
assert "## Resolution" not in content
|
||||
assert "Should not appear" not in content
|
||||
|
||||
Reference in New Issue
Block a user