Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/poller/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,20 @@ async def watch(
)
for key in body.tickets:
await watcher.add(key.upper())
return {"watching": watcher.list()}
return {"watching": watcher.list_tickets()}


@app.delete("/watch/{ticket_key}", status_code=200)
async def unwatch(ticket_key: str) -> dict[str, Any]:
removed = await watcher.remove(ticket_key.upper())
if not removed:
raise HTTPException(status_code=404, detail=f"{ticket_key} not in watch list")
return {"watching": watcher.list()}
return {"watching": watcher.list_tickets()}


@app.get("/watch")
async def list_watched() -> dict[str, Any]:
return {"watching": watcher.list()}
return {"watching": watcher.list_tickets()}


@app.get("/health")
Expand Down
2 changes: 1 addition & 1 deletion src/poller/watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ async def remove(self, ticket_key: str) -> bool:
save_state(self._state_file, self._state)
return True

def list(self) -> list[dict]:
def list_tickets(self) -> list[dict]:
def _entry(s: TicketState, children: list[dict] | None = None) -> dict:
return {
"ticket_key": s.ticket_key,
Expand Down
8 changes: 4 additions & 4 deletions tests/test_epic_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def test_children_nested_under_parent(self):
),
}

result = watcher.list()
result = watcher.list_tickets()

parents = [t for t in result if t["ticket_key"] == "AISOS-566"]
assert len(parents) == 1
Expand All @@ -239,7 +239,7 @@ def test_children_not_duplicated_at_top_level(self):
),
}

result = watcher.list()
result = watcher.list_tickets()

top_level_keys = [t["ticket_key"] for t in result]
assert "AISOS-567" not in top_level_keys
Expand All @@ -251,7 +251,7 @@ def test_tickets_without_parent_have_empty_children(self):
"AISOS-566": _make_state("AISOS-566", issue_type="Feature"),
}

result = watcher.list()
result = watcher.list_tickets()

assert result[0]["children"] == []

Expand All @@ -266,7 +266,7 @@ def test_orphan_children_appear_at_top_level(self):
),
}

result = watcher.list()
result = watcher.list_tickets()

assert len(result) == 1
assert result[0]["ticket_key"] == "AISOS-567"
Expand Down