mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-07 19:22:14 +09:00
test: remove infrastructure-dependent integration suites (#1573)
This commit is contained in:
@@ -889,131 +889,4 @@ mod tests {
|
||||
assert_eq!(gif.proxy_src, gif.media["webp"].proxy_src);
|
||||
assert_eq!(gif.media["gif"].width, 320);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[ignore]
|
||||
async fn live_search_exposes_animated_image_variants() {
|
||||
let api_key = std::env::var("FLUXER_KLIPY_API_KEY")
|
||||
.or_else(|_| std::env::var("KLIPY_API_KEY"))
|
||||
.expect("FLUXER_KLIPY_API_KEY or KLIPY_API_KEY set");
|
||||
let client =
|
||||
KlipyClient::new(MediaProxyUrlBuilder::from_env().expect("media proxy env configured"))
|
||||
.expect("KLIPY client");
|
||||
|
||||
let gifs = client
|
||||
.search(&api_key, "move faster", "en_US", "US", 1)
|
||||
.await
|
||||
.expect("KLIPY search");
|
||||
let gif = gifs.first().expect("at least one GIF");
|
||||
|
||||
assert!(gif.media.contains_key("webm"));
|
||||
assert!(gif.media.contains_key("webp"));
|
||||
assert!(gif.media.contains_key("gif"));
|
||||
assert!(gif.media.contains_key("tinygif") || gif.media.contains_key("nanogif"));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[ignore]
|
||||
async fn live_accepts_es_419_locale_for_picker_endpoints() {
|
||||
let api_key = std::env::var("FLUXER_KLIPY_API_KEY")
|
||||
.or_else(|_| std::env::var("KLIPY_API_KEY"))
|
||||
.expect("FLUXER_KLIPY_API_KEY or KLIPY_API_KEY set");
|
||||
let locale = normalize_locale("es-419");
|
||||
assert_eq!(locale, "es");
|
||||
|
||||
for (endpoint, params) in [
|
||||
(
|
||||
"featured",
|
||||
vec![
|
||||
("country", "US"),
|
||||
("locale", locale.as_str()),
|
||||
("limit", "1"),
|
||||
],
|
||||
),
|
||||
(
|
||||
"categories",
|
||||
vec![
|
||||
("country", "US"),
|
||||
("locale", locale.as_str()),
|
||||
("type", "featured"),
|
||||
],
|
||||
),
|
||||
(
|
||||
"search",
|
||||
vec![
|
||||
("country", "US"),
|
||||
("locale", locale.as_str()),
|
||||
("q", "cat"),
|
||||
("limit", "1"),
|
||||
],
|
||||
),
|
||||
(
|
||||
"autocomplete",
|
||||
vec![("locale", locale.as_str()), ("q", "cat")],
|
||||
),
|
||||
] {
|
||||
assert_live_klipy_endpoint_accepts(endpoint, &api_key, ¶ms).await;
|
||||
}
|
||||
}
|
||||
|
||||
async fn assert_live_klipy_endpoint_accepts(
|
||||
endpoint: &str,
|
||||
api_key: &str,
|
||||
params: &[(&str, &str)],
|
||||
) {
|
||||
let mut url = Url::parse(&format!("{KLIPY_BASE_URL}/{endpoint}")).expect("KLIPY URL");
|
||||
{
|
||||
let mut query = url.query_pairs_mut();
|
||||
query.append_pair("client_key", CLIENT_KEY);
|
||||
query.append_pair("contentfilter", DEFAULT_CONTENT_FILTER);
|
||||
query.append_pair("key", api_key);
|
||||
for (key, value) in params {
|
||||
query.append_pair(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
let status = reqwest::Client::builder()
|
||||
.user_agent(FLUXER_USER_AGENT)
|
||||
.build()
|
||||
.expect("KLIPY HTTP client")
|
||||
.get(url)
|
||||
.send()
|
||||
.await
|
||||
.expect("KLIPY live request")
|
||||
.status();
|
||||
assert!(
|
||||
status.is_success(),
|
||||
"KLIPY {endpoint} request failed with status {status}"
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[ignore]
|
||||
async fn live_resolves_klipy_url_with_direct_lookup() {
|
||||
let api_key = std::env::var("FLUXER_KLIPY_API_KEY")
|
||||
.or_else(|_| std::env::var("KLIPY_API_KEY"))
|
||||
.expect("FLUXER_KLIPY_API_KEY or KLIPY_API_KEY set");
|
||||
let client =
|
||||
KlipyClient::new(MediaProxyUrlBuilder::from_env().expect("media proxy env configured"))
|
||||
.expect("KLIPY client");
|
||||
|
||||
let gif = client
|
||||
.resolve_by_url(
|
||||
&api_key,
|
||||
"https://klipy.com/gifs/goatplaybanjo-chat-4",
|
||||
"en-US",
|
||||
"US",
|
||||
)
|
||||
.await
|
||||
.expect("KLIPY direct lookup")
|
||||
.expect("resolved GIF");
|
||||
|
||||
assert_eq!(gif.slug, "goatplaybanjo-chat-4");
|
||||
assert_eq!(gif.provider, KLIPY_PROVIDER_NAME);
|
||||
assert_eq!(gif.url, "https://klipy.com/gifs/goatplaybanjo-chat-4");
|
||||
assert!(gif.width > 0);
|
||||
assert!(gif.height > 0);
|
||||
assert!(gif.media.contains_key("webm") || gif.media.contains_key("mp4"));
|
||||
assert!(gif.proxy_src.starts_with("http"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user