generated from coulomb/repo-seed
Workplan consistency optimization
This commit is contained in:
@@ -192,6 +192,59 @@ class TestWorkstreams:
|
||||
assert r.status_code == 200
|
||||
assert "workstreams" in r.json()
|
||||
|
||||
async def test_workplan_bindings_sync_populates_index(self, client, tmp_path):
|
||||
await _create_domain(client)
|
||||
topic = await _create_topic(client)
|
||||
repo = await _create_repo(client, slug="binding-repo", local_path=str(tmp_path))
|
||||
ws = await _create_workplan(
|
||||
client,
|
||||
repo["id"],
|
||||
topic_id=topic["id"],
|
||||
slug="binding-wp",
|
||||
title="Binding WP",
|
||||
)
|
||||
|
||||
workplans_dir = tmp_path / "workplans"
|
||||
workplans_dir.mkdir()
|
||||
wp_file = workplans_dir / "BIND-WP-0001-demo.md"
|
||||
wp_file.write_text(
|
||||
"---\n"
|
||||
f"id: BIND-WP-0001\n"
|
||||
"type: workplan\n"
|
||||
"title: Binding WP\n"
|
||||
"status: active\n"
|
||||
f'state_hub_workstream_id: "{ws["id"]}"\n'
|
||||
"---\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
sync = await client.put(
|
||||
"/workplans/index/bindings",
|
||||
json={
|
||||
"bindings": [
|
||||
{
|
||||
"workplan_id": ws["id"],
|
||||
"filename": wp_file.name,
|
||||
"relative_path": "workplans/BIND-WP-0001-demo.md",
|
||||
"repo_slug": "binding-repo",
|
||||
"archived": False,
|
||||
"status": "active",
|
||||
}
|
||||
]
|
||||
},
|
||||
)
|
||||
assert sync.status_code == 200
|
||||
assert sync.json()["updated"] == 1
|
||||
|
||||
hide = await client.patch("/repos/binding-repo", json={"local_path": "/nonexistent/path"})
|
||||
assert hide.status_code == 200
|
||||
|
||||
r = await client.get("/workplans/index?refresh=true")
|
||||
assert r.status_code == 200
|
||||
entry = r.json()["workplans"][ws["id"]]
|
||||
assert entry["filename"] == wp_file.name
|
||||
assert entry["repo_slug"] == "binding-repo"
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Task tests
|
||||
|
||||
Reference in New Issue
Block a user