test: fix authenticated testing in CI

This commit is contained in:
ThetaDev 2024-10-24 00:42:19 +02:00
parent 2a82e44125
commit 1eecde4d6b
3 changed files with 20 additions and 11 deletions

View file

@ -29,10 +29,11 @@ jobs:
- name: 🧪 Test - name: 🧪 Test
run: | run: |
echo "${{ secrets.RUSTYPIPE_CACHE }}" > rustypipe_cache.json printf "$RUSTYPIPE_CACHE" > rustypipe_cache.json
cargo nextest run --config-file ~/.config/nextest.toml --profile ci --retries 2 --features rss --workspace cargo nextest run --config-file ~/.config/nextest.toml --profile ci --retries 2 --features rss --workspace
env: env:
ALL_PROXY: "http://warpproxy:8124" ALL_PROXY: "http://warpproxy:8124"
RUSTYPIPE_CACHE: "${{ secrets.RUSTYPIPE_CACHE }}"
- name: 💌 Upload test report - name: 💌 Upload test report
if: always() if: always()

View file

@ -605,17 +605,17 @@ impl RustyPipeBuilder {
Box::new(FileStorage::new(cache_file)) Box::new(FileStorage::new(cache_file))
}); });
let mut cdata = storage let mut cdata = if let Some(data) = storage.as_ref().and_then(|storage| storage.read()) {
.as_ref() match serde_json::from_str::<CacheData>(&data) {
.and_then(|storage| storage.read()) Ok(data) => data,
.and_then(|data| match serde_json::from_str::<CacheData>(&data) {
Ok(data) => Some(data),
Err(e) => { Err(e) => {
tracing::error!("Could not deserialize cache. Error: {}", e); tracing::error!("Could not deserialize cache. Error: {}", e);
None CacheData::default()
} }
}) }
.unwrap_or_default(); } else {
CacheData::default()
};
let cache_clients = [ let cache_clients = [
ClientType::Desktop, ClientType::Desktop,

View file

@ -234,7 +234,7 @@ async fn check_video_stream(s: impl YtStream) {
)] )]
#[tokio::test] #[tokio::test]
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
async fn get_player( async fn get_player_videos(
#[case] id: &str, #[case] id: &str,
#[case] name: &str, #[case] name: &str,
#[case] description: &str, #[case] description: &str,
@ -247,7 +247,7 @@ async fn get_player(
rp: RustyPipe, rp: RustyPipe,
) { ) {
if id == "ZDKQmBWTRnw" && !rp.query().auth_enabled() { if id == "ZDKQmBWTRnw" && !rp.query().auth_enabled() {
tracing::warn!("unauthenticated; age-limited video cannot be tested"); eprintln!("unauthenticated; age-limited video cannot be tested");
return; return;
} }
@ -2675,6 +2675,14 @@ async fn isrc_search_languages(rp: RustyPipe) {
} }
} }
#[rstest]
#[tokio::test]
async fn user_auth_check_login(rp: RustyPipe) {
if rp.query().auth_enabled() {
rp.user_auth_check_login().await.unwrap();
}
}
//#TESTUTIL //#TESTUTIL
/// Get the language setting from the environment variable /// Get the language setting from the environment variable