Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e6a0603fc3 |
@@ -209,6 +209,37 @@ class TestQueueRoutes(unittest.TestCase):
|
||||
self.assertIsNotNone(snapshot.fetch_error)
|
||||
self.assertEqual(len(snapshot.prs), 0)
|
||||
|
||||
def test_queue_fail_closed_hides_empty_state_copy(self):
|
||||
with mock.patch("webui.queue_loader.get_auth_header", return_value=None):
|
||||
snapshot = load_queue_snapshot()
|
||||
with mock.patch("webui.app.load_queue_snapshot", return_value=snapshot):
|
||||
response = self.client.get("/queue")
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertIn("Queue unavailable", response.text)
|
||||
self.assertIn("not fetched", response.text.lower())
|
||||
self.assertNotIn("No open items.", response.text)
|
||||
self.assertNotIn("Open pull requests", response.text)
|
||||
self.assertNotIn("pages_fetched", response.text)
|
||||
|
||||
def test_queue_successful_empty_inventory_shows_empty_state(self):
|
||||
def _empty_prs(*_args, **_kwargs):
|
||||
return [], _mock_pagination(0)
|
||||
|
||||
def _empty_issues(*_args, **_kwargs):
|
||||
return [], _mock_pagination(0)
|
||||
|
||||
snapshot = load_queue_snapshot(
|
||||
fetch_prs=_empty_prs,
|
||||
fetch_issues=_empty_issues,
|
||||
)
|
||||
with mock.patch("webui.app.load_queue_snapshot", return_value=snapshot):
|
||||
response = self.client.get("/queue")
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertIsNone(snapshot.fetch_error)
|
||||
self.assertEqual(response.text.count("No open items."), 2)
|
||||
self.assertIn("pages_fetched", response.text)
|
||||
self.assertIn("pagination (complete)", response.text)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
+12
-1
@@ -72,6 +72,18 @@ def render_queue_page(snapshot: QueueSnapshot) -> str:
|
||||
f'<div class="stub"><p><strong>Queue unavailable:</strong> '
|
||||
f"{html.escape(snapshot.fetch_error)}</p></div>"
|
||||
)
|
||||
inventory_block = (
|
||||
"<p class='muted'><strong>Inventory:</strong> not fetched "
|
||||
"(fail closed — queue tables omitted).</p>"
|
||||
)
|
||||
return (
|
||||
"<h2>Live queue</h2>"
|
||||
f"<p class='meta'>Repository: <code>{html.escape(snapshot.repo_label)}</code> "
|
||||
f"· project <code>{html.escape(snapshot.project_id)}</code></p>"
|
||||
f"{error_block}"
|
||||
f"{inventory_block}"
|
||||
"<p class='muted'>Read-only MVP — claims, reviews, and merges stay in Gitea/MCP tools.</p>"
|
||||
)
|
||||
|
||||
pr_section = _queue_table(
|
||||
title="Open pull requests",
|
||||
@@ -101,7 +113,6 @@ def render_queue_page(snapshot: QueueSnapshot) -> str:
|
||||
"<h2>Live queue</h2>"
|
||||
f"<p class='meta'>Repository: <code>{html.escape(snapshot.repo_label)}</code> "
|
||||
f"· project <code>{html.escape(snapshot.project_id)}</code></p>"
|
||||
f"{error_block}"
|
||||
f"{_pagination_html('PR', snapshot.pr_pagination)}"
|
||||
f"{pr_section}"
|
||||
f"{_pagination_html('Issue', snapshot.issue_pagination)}"
|
||||
|
||||
Reference in New Issue
Block a user