test: expect user auth when running in CI

This commit is contained in:
ThetaDev 2024-10-24 00:57:47 +02:00
parent 9e2fe61267
commit d452af4fb7
No known key found for this signature in database
GPG key ID: E319D3C5148D65B6
2 changed files with 12 additions and 3 deletions

View file

@ -244,9 +244,10 @@ async fn get_player_videos(
#[case] views: u64,
#[case] is_live: bool,
#[case] is_live_content: bool,
auth_enabled: bool,
rp: RustyPipe,
) {
if id == "ZDKQmBWTRnw" && !rp.query().auth_enabled() {
if id == "ZDKQmBWTRnw" && !auth_enabled {
eprintln!("unauthenticated; age-limited video cannot be tested");
return;
}
@ -2677,8 +2678,9 @@ async fn isrc_search_languages(rp: RustyPipe) {
#[rstest]
#[tokio::test]
async fn user_auth_check_login(rp: RustyPipe) {
if rp.query().auth_enabled() {
async fn user_auth_check_login(rp: RustyPipe, auth_enabled: bool) {
if auth_enabled {
assert!(rp.query().auth_enabled());
rp.user_auth_check_login().await.unwrap();
}
}
@ -2712,6 +2714,12 @@ fn unlocalized(lang: Language) -> bool {
lang == Language::En
}
/// 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()
}
/*
/// Get a new RustyPipe instance with pre-set visitor data
fn rp_visitor_data(vdata: &str) -> RustyPipe {