From 73572cde30c71388d70fe30ecdbdcdf96d787073 Mon Sep 17 00:00:00 2001 From: VC Date: Fri, 17 May 2024 11:58:12 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=85:=20add=20tests=20to=20peertube=20?= =?UTF-8?q?lib?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/peertube.rs | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/peertube.rs b/src/peertube.rs index da86a49..a30eb14 100644 --- a/src/peertube.rs +++ b/src/peertube.rs @@ -503,3 +503,49 @@ pub async fn get_playlists_to_be_added_to( Ok(playlist_to_be_added_to) } + +#[cfg(test)] +mod tests { + use super::*; + + #[tokio::test] + async fn test_get_latest_video() { + let peertube = PeerTube::new("https://peertube.cpy.re"); + + let vid = peertube.get_latest_video().await.unwrap(); + + assert_eq!(vid.uuid.len(), 36); + } + + #[tokio::test] + #[should_panic] + async fn test_get_original_video_source() { + let peertube = PeerTube::new("https://peertube.cpy.re"); + + let _vid = peertube + .get_original_video_source("t") + .await + .expect("Should panic!"); + } + + #[tokio::test] + async fn test_list_video_playlists() { + let peertube = PeerTube::new("https://peertube.cpy.re"); + + let pl = peertube.list_video_playlists().await.unwrap(); + + assert!(!pl.is_empty()); + } + + #[tokio::test] + async fn test_list_videos_playlist() { + let peertube = PeerTube::new("https://peertube.cpy.re"); + + let pl_videos = peertube + .list_videos_playlist("73a5c1fa-64c5-462d-81e5-b120781c2d72") + .await + .unwrap(); + + assert!(!pl_videos.is_empty()); + } +} From cc86a88771ef60f29c6a7344bcc73b885a11ecfc Mon Sep 17 00:00:00 2001 From: VC Date: Fri, 17 May 2024 11:59:26 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=94=96:=20bump=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a7705ec..2b12956 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1192,7 +1192,7 @@ dependencies = [ [[package]] name = "tootube" -version = "0.7.0" +version = "0.7.1" dependencies = [ "async-stream", "clap", diff --git a/Cargo.toml b/Cargo.toml index 8156dfe..60b4a3a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tootube" authors = ["VC "] -version = "0.7.0" +version = "0.7.1" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html