test: expect user auth when running in CI
This commit is contained in:
parent
9e2fe61267
commit
d452af4fb7
2 changed files with 12 additions and 3 deletions
|
|
@ -34,6 +34,7 @@ jobs:
|
|||
env:
|
||||
ALL_PROXY: "http://warpproxy:8124"
|
||||
RUSTYPIPE_CACHE: "${{ secrets.RUSTYPIPE_CACHE }}"
|
||||
YT_AUTHENTICATED: "1"
|
||||
|
||||
- name: 💌 Upload test report
|
||||
if: always()
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Reference in a new issue