AI Implementation feature(1089): Scheduled Execution with Cron and Retry Handling (#9)

This commit was merged in pull request #9.
This commit is contained in:
2026-08-04 20:48:16 +00:00
parent 3545b81546
commit 5f6ddf76a4
27 changed files with 644 additions and 272 deletions
+29 -1
View File
@@ -130,6 +130,33 @@ def test_publish_mastodon_success_invokes_client_with_composed_status(
assert fake.access_token == "test-token"
def test_publish_mastodon_missing_token_is_fatal(full_config) -> None:
from tenbackward.publishing import PublishFatalError
match = _make_match("2016/2016-08-04-foo.md", "Foo")
fake = _FakeMastodon()
bad_config = type(full_config)(
mastodon_base_url=full_config.mastodon_base_url,
mastodon_access_token="",
mastodon_visibility=full_config.mastodon_visibility,
site_url=full_config.site_url,
hashtags=full_config.hashtags,
throwback_prefix=full_config.throwback_prefix,
max_retries=full_config.max_retries,
run_at=full_config.run_at,
tz=full_config.tz,
data_dir=full_config.data_dir,
blog_repo_url=full_config.blog_repo_url,
blog_dir=full_config.blog_dir,
extra=dict(full_config.extra),
)
with pytest.raises(PublishFatalError):
publish_mastodon(bad_config, [match], client_factory=fake)
assert fake.calls == []
def test_publish_mastodon_api_failure_raises_and_does_not_persist(
full_config, tmp_path: Path
) -> None:
@@ -140,6 +167,7 @@ def test_publish_mastodon_api_failure_raises_and_does_not_persist(
publish_mastodon(full_config, [match], client_factory=fake)
assert "publish_failed" in str(exc_info.value)
assert "mastodon post" in str(exc_info.value)
assert isinstance(exc_info.value.__cause__, RuntimeError)
store = PostedStore(tmp_path)
@@ -180,7 +208,7 @@ def test_publish_mastodon_combined_status_for_multiple_matches(full_config) -> N
def test_publish_mastodon_uses_config_visibility(env_setup, tmp_path: Path) -> None:
os.environ["VISIBILITY"] = "unlisted"
os.environ["MASTODON_VISIBILITY"] = "unlisted"
os.environ["DATA_DIR"] = str(tmp_path)
config = load_config()
match = _make_match("2016/2016-08-04-foo.md", "Foo")