ci: skip authenticated tests

This commit is contained in:
ThetaDev 2025-01-13 03:46:45 +01:00
parent 75c3746890
commit 51dacf8df2
No known key found for this signature in database
GPG key ID: E319D3C5148D65B6
3 changed files with 97 additions and 151 deletions

View file

@ -28,15 +28,9 @@ jobs:
run: cargo clippy --all --tests --features=rss,indicatif,audiotag -- -D warnings
- name: 🧪 Test
run: |
printf '%s\n' "$RUSTYPIPE_CACHE" > rustypipe_cache.json
echo "authenticated=$YT_AUTHENTICATED"
wc -c rustypipe_cache.json
cargo nextest run --config-file ~/.config/nextest.toml --profile ci --retries 2 --features rss --workspace
run: cargo nextest run --config-file ~/.config/nextest.toml --profile ci --retries 2 --features rss --workspace -- --skip 'cookie_auth::'
env:
ALL_PROXY: "http://warpproxy:8124"
RUSTYPIPE_CACHE: "${{ secrets.RUSTYPIPE_CACHE }}"
YT_AUTHENTICATED: "${{ secrets.RUSTYPIPE_CACHE != '' }}"
- name: Move test report
if: always()

View file

@ -1,15 +1,19 @@
test:
# cargo test --features=rss
cargo nextest run --workspace --features=rss --no-fail-fast --retries 1
cargo nextest run --workspace --features=rss --no-fail-fast --retries 1 -- --skip 'cookie_auth::'
unittest:
cargo nextest run --features=rss --no-fail-fast --lib
testyt:
cargo nextest run --features=rss --no-fail-fast --retries 1 --test youtube -- --skip 'cookie_auth::'
testyt-cookie:
cargo nextest run --features=rss --no-fail-fast --retries 1 --test youtube
testyt-localized:
YT_LANG=th cargo nextest run --features=rss --no-fail-fast ---retries 1 --test youtube
YT_LANG=th cargo nextest run --features=rss --no-fail-fast --retries 1 --test youtube -- \
--skip 'cookie_auth::' --skip 'search_suggestion' --skip 'isrc_search_languages'
testintl:
#!/usr/bin/env bash
@ -28,7 +32,8 @@ testintl:
for YT_LANG in "${LANGUAGES[@]}"; do
echo "---TESTS FOR $YT_LANG ---"
if YT_LANG="$YT_LANG" cargo nextest run --no-fail-fast --retries 1 --test-threads 4 --test youtube -E 'not test(/^resolve/)'; then
if YT_LANG="$YT_LANG" cargo nextest run --no-fail-fast --retries 1 --test-threads 4 --test youtube -- \
--skip 'cookie_auth::' --skip 'search_suggestion' --skip 'isrc_search_languages' --skip 'resolve_'; then
echo "--- $YT_LANG COMPLETED ---"
else
echo "--- $YT_LANG FAILED ---"

View file

@ -2734,6 +2734,94 @@ async fn isrc_search_languages(rp: RustyPipe) {
}
}
mod cookie_auth {
use super::*;
#[rstest]
#[tokio::test]
async fn history(rp: RustyPipe) {
let videos = rp.query().history().await.unwrap();
assert_next_history(videos, rp.query(), 100).await;
}
#[rstest]
#[tokio::test]
async fn history_search(rp: RustyPipe) {
let videos = rp.query().history_search("a").await.unwrap();
assert_next_history(videos, rp.query(), 5).await;
}
#[rstest]
#[tokio::test]
async fn subscriptions(rp: RustyPipe) {
let channels = rp.query().subscriptions().await.unwrap();
assert_next_items(channels, rp.query(), 5).await;
}
#[rstest]
#[tokio::test]
async fn subscription_feed(rp: RustyPipe) {
let videos = rp.query().subscription_feed().await.unwrap();
assert_next_items(videos, rp.query(), 50).await;
}
#[rstest]
#[tokio::test]
async fn liked_videos(rp: RustyPipe) {
let videos = rp.query().liked_videos().await.unwrap();
assert_next_items(videos.videos, rp.query(), 5).await;
}
#[rstest]
#[tokio::test]
async fn watch_later(rp: RustyPipe) {
let videos = rp.query().watch_later().await.unwrap();
assert_next_items(videos.videos, rp.query(), 5).await;
}
#[rstest]
#[tokio::test]
async fn music_history(rp: RustyPipe) {
let tracks = rp.query().music_history().await.unwrap();
assert_next_music_history(tracks, rp.query(), 150).await;
}
#[rstest]
#[tokio::test]
async fn music_saved_artists(rp: RustyPipe) {
let artists = rp.query().music_saved_artists().await.unwrap();
assert_next_items(artists, rp.query(), 5).await;
}
#[rstest]
#[tokio::test]
async fn music_saved_albums(rp: RustyPipe) {
let albums = rp.query().music_saved_albums().await.unwrap();
assert_next_items(albums, rp.query(), 5).await;
}
#[rstest]
#[tokio::test]
async fn music_saved_tracks(rp: RustyPipe) {
let tracks = rp.query().music_saved_tracks().await.unwrap();
assert_next_items(tracks, rp.query(), 50).await;
}
#[rstest]
#[tokio::test]
async fn music_saved_playlists(rp: RustyPipe) {
let playlists = rp.query().music_saved_playlists().await.unwrap();
assert_next_items(playlists, rp.query(), 5).await;
}
#[rstest]
#[tokio::test]
async fn music_liked_tracks(rp: RustyPipe) {
let tracks = rp.query().music_liked_tracks().await.unwrap();
assert_next_items(tracks.tracks, rp.query(), 5).await;
}
}
#[rstest]
#[tokio::test]
async fn user_auth_check_login(rp: RustyPipe, auth_enabled: bool) {
@ -2743,138 +2831,6 @@ async fn user_auth_check_login(rp: RustyPipe, auth_enabled: bool) {
}
}
#[rstest]
#[tokio::test]
async fn history(rp: RustyPipe, cookie_auth_enabled: bool) {
if !cookie_auth_enabled {
return;
}
let videos = rp.query().history().await.unwrap();
assert_next_history(videos, rp.query(), 100).await;
}
#[rstest]
#[tokio::test]
async fn history_search(rp: RustyPipe, cookie_auth_enabled: bool) {
if !cookie_auth_enabled {
return;
}
let videos = rp.query().history_search("a").await.unwrap();
assert_next_history(videos, rp.query(), 5).await;
}
#[rstest]
#[tokio::test]
async fn subscriptions(rp: RustyPipe, cookie_auth_enabled: bool) {
if !cookie_auth_enabled {
return;
}
let channels = rp.query().subscriptions().await.unwrap();
assert_next_items(channels, rp.query(), 5).await;
}
#[rstest]
#[tokio::test]
async fn subscription_feed(rp: RustyPipe, cookie_auth_enabled: bool) {
if !cookie_auth_enabled {
return;
}
let videos = rp.query().subscription_feed().await.unwrap();
assert_next_items(videos, rp.query(), 50).await;
}
#[rstest]
#[tokio::test]
async fn liked_videos(rp: RustyPipe, cookie_auth_enabled: bool) {
if !cookie_auth_enabled {
return;
}
let videos = rp.query().liked_videos().await.unwrap();
assert_next_items(videos.videos, rp.query(), 5).await;
}
#[rstest]
#[tokio::test]
async fn watch_later(rp: RustyPipe, cookie_auth_enabled: bool) {
if !cookie_auth_enabled {
return;
}
let videos = rp.query().watch_later().await.unwrap();
assert_next_items(videos.videos, rp.query(), 5).await;
}
#[rstest]
#[tokio::test]
async fn music_history(rp: RustyPipe, cookie_auth_enabled: bool) {
if !cookie_auth_enabled {
return;
}
let tracks = rp.query().music_history().await.unwrap();
assert_next_music_history(tracks, rp.query(), 150).await;
}
#[rstest]
#[tokio::test]
async fn music_saved_artists(rp: RustyPipe, cookie_auth_enabled: bool) {
if !cookie_auth_enabled {
return;
}
let artists = rp.query().music_saved_artists().await.unwrap();
assert_next_items(artists, rp.query(), 5).await;
}
#[rstest]
#[tokio::test]
async fn music_saved_albums(rp: RustyPipe, cookie_auth_enabled: bool) {
if !cookie_auth_enabled {
return;
}
let albums = rp.query().music_saved_albums().await.unwrap();
assert_next_items(albums, rp.query(), 5).await;
}
#[rstest]
#[tokio::test]
async fn music_saved_tracks(rp: RustyPipe, cookie_auth_enabled: bool) {
if !cookie_auth_enabled {
return;
}
let tracks = rp.query().music_saved_tracks().await.unwrap();
assert_next_items(tracks, rp.query(), 50).await;
}
#[rstest]
#[tokio::test]
async fn music_saved_playlists(rp: RustyPipe, cookie_auth_enabled: bool) {
if !cookie_auth_enabled {
return;
}
let playlists = rp.query().music_saved_playlists().await.unwrap();
assert_next_items(playlists, rp.query(), 5).await;
}
#[rstest]
#[tokio::test]
async fn music_liked_tracks(rp: RustyPipe, cookie_auth_enabled: bool) {
if !cookie_auth_enabled {
return;
}
let tracks = rp.query().music_liked_tracks().await.unwrap();
assert_next_items(tracks.tracks, rp.query(), 5).await;
}
//#TESTUTIL
/// Get the language setting from the environment variable
@ -2914,15 +2870,6 @@ fn auth_enabled(rp: RustyPipe) -> bool {
|| rp.query().auth_enabled(ClientType::Tv)
}
/// Get a flag signaling if an authenticated user is expected
#[fixture]
fn cookie_auth_enabled(rp: RustyPipe) -> bool {
std::env::var("YT_AUTHENTICATED")
.map(|v| !v.is_empty() && !v.eq_ignore_ascii_case("false"))
.unwrap_or_default()
|| rp.query().auth_enabled(ClientType::Desktop)
}
/*
/// Get a new RustyPipe instance with pre-set visitor data
fn rp_visitor_data(vdata: &str) -> RustyPipe {