fix(quality_nudge,bluesky): gate Instagram nudge on EXCLUDE_SOURCES + anchor bluesky tests at resolver
This commit is contained in:
+11
-6
@@ -231,13 +231,18 @@ class TestSearchEndpointHostResolution(unittest.TestCase):
|
||||
else:
|
||||
os.environ.pop("BSKY_SEARCH_HOST", None)
|
||||
|
||||
def test_module_constant_uses_canonical_appview(self):
|
||||
# Regression guard against the public mirror reappearing as the default
|
||||
self.assertIn("api.bsky.app", bluesky.BSKY_SEARCH_URL)
|
||||
def test_resolver_default_uses_canonical_appview(self):
|
||||
# Regression guard against the public mirror reappearing as the default.
|
||||
# Anchored at the resolver because that is the code path search_bluesky
|
||||
# actually calls; a module-level constant would not catch a resolver
|
||||
# regression.
|
||||
self.assertIn("api.bsky.app", bluesky._resolve_search_url())
|
||||
|
||||
def test_module_constant_does_not_use_public_mirror(self):
|
||||
# Hard regression guard — the exact host that BunnyCDN was blocking
|
||||
self.assertNotIn("public.api.bsky.app", bluesky.BSKY_SEARCH_URL)
|
||||
def test_resolver_default_does_not_use_public_mirror(self):
|
||||
# Hard regression guard — the exact host that BunnyCDN was blocking.
|
||||
# Asserted at the resolver level (the runtime path) so a default-host
|
||||
# regression in _resolve_search_url is actually caught.
|
||||
self.assertNotIn("public.api.bsky.app", bluesky._resolve_search_url())
|
||||
|
||||
def test_resolver_default_when_no_override(self):
|
||||
self.assertEqual(
|
||||
|
||||
@@ -469,3 +469,49 @@ class TestInstagramSilentFailure:
|
||||
q = _compute()
|
||||
assert q.get("bonus_errored") == []
|
||||
|
||||
def test_exclude_sources_instagram_suppresses_silent_failure(self):
|
||||
"""User set EXCLUDE_SOURCES=instagram - the source intentionally did
|
||||
not run, so the zero-count instagram_items_count written by
|
||||
last30days.py is a non-event, not a silent failure. Pre-fix: the
|
||||
nudge fired anyway because the gate only checked SC-key + count.
|
||||
"""
|
||||
q = _compute(
|
||||
config_overrides={
|
||||
"AUTH_TOKEN": "tok123",
|
||||
"SCRAPECREATORS_API_KEY": "sc_key",
|
||||
"EXCLUDE_SOURCES": "instagram",
|
||||
},
|
||||
ytdlp_installed=True,
|
||||
result_overrides={"instagram_items_count": 0},
|
||||
)
|
||||
assert "instagram" not in q["bonus_errored"]
|
||||
assert q["nudge_text"] is None
|
||||
|
||||
def test_exclude_sources_multi_value_with_instagram(self):
|
||||
"""Canonical parsing pattern is comma-separated; case-insensitive."""
|
||||
q = _compute(
|
||||
config_overrides={
|
||||
"AUTH_TOKEN": "tok123",
|
||||
"SCRAPECREATORS_API_KEY": "sc_key",
|
||||
"EXCLUDE_SOURCES": "threads, Instagram , pinterest",
|
||||
},
|
||||
ytdlp_installed=True,
|
||||
result_overrides={"instagram_items_count": 0},
|
||||
)
|
||||
assert "instagram" not in q["bonus_errored"]
|
||||
|
||||
def test_exclude_sources_other_value_still_flags(self):
|
||||
"""EXCLUDE_SOURCES that does not mention instagram must not suppress
|
||||
the silent-failure nudge for instagram.
|
||||
"""
|
||||
q = _compute(
|
||||
config_overrides={
|
||||
"AUTH_TOKEN": "tok123",
|
||||
"SCRAPECREATORS_API_KEY": "sc_key",
|
||||
"EXCLUDE_SOURCES": "threads",
|
||||
},
|
||||
ytdlp_installed=True,
|
||||
result_overrides={"instagram_items_count": 0},
|
||||
)
|
||||
assert "instagram" in q["bonus_errored"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user