Gated Patreon posts: skip on ingest + cleanup tool (#874) #112
@@ -665,6 +665,19 @@ async def test_backfill_skips_already_captured_post_but_recapture_forces_it(
|
||||
)
|
||||
assert len(res_recap.post_record_paths) == 1 # gate bypassed → recaptured
|
||||
assert downloader2.post_records == 1
|
||||
assert res_recap.files_downloaded == 0 # no media re-download
|
||||
assert downloader2.download_calls == 0
|
||||
# The on-disk media is surfaced as a (path, CDN url) relink pair.
|
||||
assert len(res_recap.relink_source_paths) == 1
|
||||
rel_path, rel_url = res_recap.relink_source_paths[0]
|
||||
assert rel_url == m1.url
|
||||
# Diagnostic summary surfaces the post-record + relink counts (operator reads
|
||||
# this off the event stdout to see what a recapture actually did).
|
||||
assert "1 post-record(s), 1 relinked" in res_recap.stdout
|
||||
# #842: per-post handling is written into the SAME run stdout (reuses the
|
||||
# existing "Raw stdout" panel) — post_type + body length, so an empty body is
|
||||
# self-explanatory by its post_type.
|
||||
assert f"post p1 [image_file] body: {len('<p>body p1</p>')} chars" in res_recap.stdout
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@@ -689,7 +702,8 @@ async def test_gated_post_skipped_entirely_no_media_no_record(
|
||||
# Only the accessible post's media downloaded; the gated post contributed
|
||||
# nothing — no file, no post-record.
|
||||
assert result.files_downloaded == 1
|
||||
assert [p for p in result.written_paths if "gated" in p] == []
|
||||
# (substring check on the basename only — the tmp dir name contains "gated")
|
||||
assert not any(p.endswith("gated_1.jpg") for p in result.written_paths)
|
||||
assert downloader.download_calls == 1
|
||||
assert len(result.post_record_paths) == 1 # only the open post
|
||||
assert downloader.post_records == 1
|
||||
@@ -711,19 +725,6 @@ async def test_preview_excludes_gated_posts(source_id, sync_engine, tmp_path):
|
||||
preview = ing.preview(source_id, "c1")
|
||||
assert preview["total_new"] == 1 # only the open post
|
||||
assert [s for s in preview["sample"] if s["title"] == "gated"] == []
|
||||
assert res_recap.files_downloaded == 0 # no media re-download
|
||||
assert downloader2.download_calls == 0
|
||||
# The on-disk media is surfaced as a (path, CDN url) relink pair.
|
||||
assert len(res_recap.relink_source_paths) == 1
|
||||
rel_path, rel_url = res_recap.relink_source_paths[0]
|
||||
assert rel_url == m1.url
|
||||
# Diagnostic summary surfaces the post-record + relink counts (operator reads
|
||||
# this off the event stdout to see what a recapture actually did).
|
||||
assert "1 post-record(s), 1 relinked" in res_recap.stdout
|
||||
# #842: per-post handling is written into the SAME run stdout (reuses the
|
||||
# existing "Raw stdout" panel) — post_type + body length, so an empty body is
|
||||
# self-explanatory by its post_type.
|
||||
assert f"post p1 [image_file] body: {len('<p>body p1</p>')} chars" in res_recap.stdout
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
Reference in New Issue
Block a user