mirror of
https://github.com/TheFunny/TelegramTwitterMediaBot.git
synced 2026-09-29 00:12:12 +00:00
refactor(x-media): drop the per-site fns the Site defaults already cover
twitter, bsky, misskey and bilibili each carried enabled() -> true, media_headers(url) -> None and is_retryable(err) -> the trait's own default, with no caller outside their tests (the adapters never override those methods, so the default was already the production policy). The tests that only restated the default are gone; the two that pin site-specific classes (bsky's MediaPrep, bilibili's risk-control codes) now ask the Site impl, and site/mod.rs keeps one assertion of the shared retry policy. The live verification notes (no Referer needed for hdslb/twimg) survive as comments.
This commit is contained in:
@@ -891,8 +891,10 @@ mod tests {
|
||||
};
|
||||
assert_eq!(err.to_string(), "example error: boom");
|
||||
assert!(err.source().is_some());
|
||||
// Permanent by default: no site's is_retryable matches it.
|
||||
assert!(!twitter::is_retryable(&err));
|
||||
// Permanent by default: no site's is_retryable matches it (the trait
|
||||
// default is the policy for every site that does not override it).
|
||||
assert!(!twitter::TwitterSite.is_retryable(&err));
|
||||
assert!(twitter::TwitterSite.is_retryable(&FetchError::Transient("429".into())));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user