Links and Other Enhancements

This commit is contained in:
2026-03-02 19:55:04 +00:00
parent cf84d6d2dd
commit 0ed86ee2dc
24 changed files with 475 additions and 153 deletions

View File

@@ -520,11 +520,11 @@ class TestCaptureConversions:
assert dec.impact == "medium"
@pytest.mark.asyncio
async def test_convert_to_weblink(
async def test_convert_to_link(
self, client: AsyncClient, db_session: AsyncSession,
):
cap_id = await _create_capture(db_session, "Check https://example.com/test for details")
r = await client.post(f"/capture/{cap_id}/to-weblink", data={}, follow_redirects=False)
r = await client.post(f"/capture/{cap_id}/to-link", data={}, follow_redirects=False)
assert r.status_code == 303
result = await db_session.execute(
@@ -532,10 +532,10 @@ class TestCaptureConversions:
{"id": cap_id},
)
row = result.first()
assert row.converted_to_type == "weblink"
assert row.converted_to_type == "link"
# URL should be extracted
result = await db_session.execute(
text("SELECT url FROM weblinks WHERE id = :id"), {"id": row.converted_to_id},
text("SELECT url FROM links WHERE id = :id"), {"id": row.converted_to_id},
)
assert "https://example.com/test" in result.first().url
@@ -1912,7 +1912,7 @@ class TestTaskDetailTabs:
@pytest.mark.asyncio
async def test_all_tabs_return_200(self, client: AsyncClient, seed_task: dict):
"""Every tab on task detail returns 200."""
for tab in ("overview", "notes", "weblinks", "files", "lists", "decisions", "processes", "contacts"):
for tab in ("overview", "notes", "links", "files", "lists", "decisions", "processes", "contacts"):
r = await client.get(f"/tasks/{seed_task['id']}?tab={tab}")
assert r.status_code == 200, f"Tab '{tab}' returned {r.status_code}"
@@ -2141,7 +2141,7 @@ class TestMeetingDetailTabs:
@pytest.mark.asyncio
async def test_all_meeting_tabs_return_200(self, client: AsyncClient, seed_meeting: dict):
"""Every tab on meeting detail returns 200."""
for tab in ("overview", "notes", "weblinks", "files", "lists", "processes", "contacts"):
for tab in ("overview", "notes", "links", "files", "lists", "processes", "contacts"):
r = await client.get(f"/meetings/{seed_meeting['id']}?tab={tab}")
assert r.status_code == 200, f"Meeting tab '{tab}' returned {r.status_code}"
@@ -2554,28 +2554,28 @@ class TestEntityCreateWithParentContext:
assert seed_task["id"] in r.text
@pytest.mark.asyncio
async def test_create_weblink_with_task_id(
async def test_create_link_with_task_id(
self, client: AsyncClient, db_session: AsyncSession, seed_task: dict,
):
"""Creating a weblink with task_id sets the FK."""
"""Creating a link with task_id sets the FK."""
tag = _uid()
r = await client.post("/weblinks/create", data={
"label": f"TaskWeblink-{tag}",
"label": f"TaskLink-{tag}",
"url": "https://example.com/test",
"task_id": seed_task["id"],
}, follow_redirects=False)
assert r.status_code == 303
result = await db_session.execute(
text("SELECT task_id FROM weblinks WHERE label = :l AND is_deleted = false"),
{"l": f"TaskWeblink-{tag}"},
text("SELECT task_id FROM links WHERE label = :l AND is_deleted = false"),
{"l": f"TaskLink-{tag}"},
)
row = result.first()
assert row is not None
assert str(row.task_id) == seed_task["id"]
await db_session.execute(
text("DELETE FROM weblinks WHERE label = :l"), {"l": f"TaskWeblink-{tag}"}
text("DELETE FROM links WHERE label = :l"), {"l": f"TaskLink-{tag}"}
)
await db_session.commit()