fix: hide empty-state copy on queue credential fail-closed (Closes #458)
When fetch_error is set, render only the unavailable banner and an explicit not-fetched inventory note. Suppress queue tables, pagination proof, and "No open items." copy that implied a successful empty fetch. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
@@ -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()
|
||||
Reference in New Issue
Block a user