diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index 8432bb1..d4015b8 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -34,7 +34,7 @@ jobs: env: ALL_PROXY: "http://warpproxy:8124" RUSTYPIPE_CACHE: "${{ secrets.RUSTYPIPE_CACHE }}" - YT_AUTHENTICATED: "1" + YT_AUTHENTICATED: "${{ github.event_name != 'pull_request' }}" # no access to secrets for PRs - name: 💌 Upload test report if: always() diff --git a/tests/youtube.rs b/tests/youtube.rs index c49a2c1..99b1083 100644 --- a/tests/youtube.rs +++ b/tests/youtube.rs @@ -1748,6 +1748,27 @@ async fn music_artist( } } +#[rstest] +#[tokio::test] +async fn music_artist_albums_recency(rp: RustyPipe) { + let albums = rp + .query() + .music_artist_albums("UCPC0L1d253x-KuMNwa05TpA", None, Some(AlbumOrder::Recency)) + .await + .unwrap(); + + assert_gte(albums.len(), 110, "albums"); + + let mut latest_items = albums.iter().peekable(); + while let (Some(b), Some(next_b)) = (latest_items.next(), latest_items.peek()) { + assert_gte( + b.year.expect("year"), + next_b.year.expect("year"), + "latest album year", + ); + } +} + #[rstest] #[tokio::test] async fn music_artist_not_found(rp: RustyPipe) { @@ -2717,7 +2738,10 @@ fn unlocalized(lang: Language) -> bool { /// Get a flag signaling if an authenticated user is expected #[fixture] fn auth_enabled(rp: RustyPipe) -> bool { - std::env::var("YT_AUTHENTICATED").is_ok() || rp.query().auth_enabled() + std::env::var("YT_AUTHENTICATED") + .map(|v| !v.is_empty() && v.to_ascii_lowercase() != "false") + .unwrap_or_default() + || rp.query().auth_enabled() } /*