: add tests to peertube lib

This commit is contained in:
VC
2024-05-17 11:58:12 +02:00
parent a83140145c
commit 73572cde30

View File

@@ -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());
}
}