MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / TestReadingQueueOperations

Class TestReadingQueueOperations

tests/test_db_ops.py:253–308  ·  view source on GitHub ↗

Tests for the pending reading queue helpers.

Source from the content-addressed store, hash-verified

251 """Tests for the pending reading queue helpers."""
252
253 def test_clear_pending_selected_papers_hides_old_queue_until_new_selection(self, test_db_path, sample_paper):
254 import db_ops
255 db_ops.DB_PATH = test_db_path
256
257 paper_a = dict(sample_paper)
258 paper_b = dict(sample_paper)
259 paper_b["arxiv_id"] = "2404.00002"
260 paper_b["doi"] = "10.48550/arXiv.2404.00002"
261 paper_b["title"] = "Follow-up GUI Agent with Grounded Planning"
262
263 paper_a_id = add_paper(paper_a)
264 paper_b_id = add_paper(paper_b)
265
266 log_behavior(
267 "test_user",
268 "push_001",
269 paper_a_id,
270 "selected",
271 "selected",
272 "selected",
273 metadata={"paper_number": 1},
274 )
275 latest_before_clear = get_latest_selected_papers("test_user")
276 assert latest_before_clear is not None
277 assert latest_before_clear["push_id"] == "push_001"
278
279 cleared = clear_pending_selected_papers("test_user")
280 assert cleared["cleared"] is True
281 assert cleared["cleared_count"] == 1
282 assert cleared["push_id"] == "push_001"
283 assert get_latest_selected_papers("test_user") is None
284
285 log_behavior(
286 "test_user",
287 "push_002",
288 paper_b_id,
289 "selected",
290 "selected",
291 "selected",
292 metadata={"paper_number": 1},
293 )
294 latest_after_new_selection = get_latest_selected_papers("test_user")
295 assert latest_after_new_selection is not None
296 assert latest_after_new_selection["push_id"] == "push_002"
297
298 def test_clear_pending_selected_papers_returns_empty_when_queue_is_already_clear(self, test_db_path):
299 import db_ops
300 db_ops.DB_PATH = test_db_path
301
302 cleared = clear_pending_selected_papers("test_user")
303
304 assert cleared["cleared"] is False
305 assert cleared["cleared_count"] == 0

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected