diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index 60230e6..4bdc85b 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -29,10 +29,11 @@ jobs: - name: ๐Ÿงช Test run: | - echo "${{ secrets.RUSTYPIPE_CACHE }}" > rustypipe_cache.json + printf "$RUSTYPIPE_CACHE" > rustypipe_cache.json cargo nextest run --config-file ~/.config/nextest.toml --profile ci --retries 2 --features rss --workspace env: ALL_PROXY: "http://warpproxy:8124" + RUSTYPIPE_CACHE: "${{ secrets.RUSTYPIPE_CACHE }}" - name: ๐Ÿ’Œ Upload test report if: always() diff --git a/src/client/mod.rs b/src/client/mod.rs index 4dee6f7..47788d1 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -605,17 +605,17 @@ impl RustyPipeBuilder { Box::new(FileStorage::new(cache_file)) }); - let mut cdata = storage - .as_ref() - .and_then(|storage| storage.read()) - .and_then(|data| match serde_json::from_str::(&data) { - Ok(data) => Some(data), + let mut cdata = if let Some(data) = storage.as_ref().and_then(|storage| storage.read()) { + match serde_json::from_str::(&data) { + Ok(data) => data, Err(e) => { tracing::error!("Could not deserialize cache. Error: {}", e); - None + CacheData::default() } - }) - .unwrap_or_default(); + } + } else { + CacheData::default() + }; let cache_clients = [ ClientType::Desktop, diff --git a/tests/youtube.rs b/tests/youtube.rs index fe742a7..d7394c1 100644 --- a/tests/youtube.rs +++ b/tests/youtube.rs @@ -234,7 +234,7 @@ async fn check_video_stream(s: impl YtStream) { )] #[tokio::test] #[allow(clippy::too_many_arguments)] -async fn get_player( +async fn get_player_videos( #[case] id: &str, #[case] name: &str, #[case] description: &str, @@ -247,7 +247,7 @@ async fn get_player( rp: RustyPipe, ) { if id == "ZDKQmBWTRnw" && !rp.query().auth_enabled() { - tracing::warn!("unauthenticated; age-limited video cannot be tested"); + eprintln!("unauthenticated; age-limited video cannot be tested"); return; } @@ -2675,6 +2675,14 @@ async fn isrc_search_languages(rp: RustyPipe) { } } +#[rstest] +#[tokio::test] +async fn user_auth_check_login(rp: RustyPipe) { + if rp.query().auth_enabled() { + rp.user_auth_check_login().await.unwrap(); + } +} + //#TESTUTIL /// Get the language setting from the environment variable