test: expect user auth when running in CI
This commit is contained in:
parent
1dcde78053
commit
304c0cf16c
2 changed files with 12 additions and 3 deletions
|
|
@ -34,6 +34,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
ALL_PROXY: "http://warpproxy:8124"
|
ALL_PROXY: "http://warpproxy:8124"
|
||||||
RUSTYPIPE_CACHE: "${{ secrets.RUSTYPIPE_CACHE }}"
|
RUSTYPIPE_CACHE: "${{ secrets.RUSTYPIPE_CACHE }}"
|
||||||
|
YT_AUTHENTICATED: "1"
|
||||||
|
|
||||||
- name: 💌 Upload test report
|
- name: 💌 Upload test report
|
||||||
if: always()
|
if: always()
|
||||||
|
|
|
||||||
|
|
@ -244,9 +244,10 @@ async fn get_player_videos(
|
||||||
#[case] views: u64,
|
#[case] views: u64,
|
||||||
#[case] is_live: bool,
|
#[case] is_live: bool,
|
||||||
#[case] is_live_content: bool,
|
#[case] is_live_content: bool,
|
||||||
|
auth_enabled: bool,
|
||||||
rp: RustyPipe,
|
rp: RustyPipe,
|
||||||
) {
|
) {
|
||||||
if id == "ZDKQmBWTRnw" && !rp.query().auth_enabled() {
|
if id == "ZDKQmBWTRnw" && !auth_enabled {
|
||||||
eprintln!("unauthenticated; age-limited video cannot be tested");
|
eprintln!("unauthenticated; age-limited video cannot be tested");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -2677,8 +2678,9 @@ async fn isrc_search_languages(rp: RustyPipe) {
|
||||||
|
|
||||||
#[rstest]
|
#[rstest]
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn user_auth_check_login(rp: RustyPipe) {
|
async fn user_auth_check_login(rp: RustyPipe, auth_enabled: bool) {
|
||||||
if rp.query().auth_enabled() {
|
if auth_enabled {
|
||||||
|
assert!(rp.query().auth_enabled());
|
||||||
rp.user_auth_check_login().await.unwrap();
|
rp.user_auth_check_login().await.unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2712,6 +2714,12 @@ fn unlocalized(lang: Language) -> bool {
|
||||||
lang == Language::En
|
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
|
/// Get a new RustyPipe instance with pre-set visitor data
|
||||||
fn rp_visitor_data(vdata: &str) -> RustyPipe {
|
fn rp_visitor_data(vdata: &str) -> RustyPipe {
|
||||||
|
|
|
||||||
Reference in a new issue