test: add map_playlist_cont test
This commit is contained in:
parent
4f48ad59bd
commit
39fca50731
4 changed files with 23637 additions and 0 deletions
|
|
@ -16,6 +16,7 @@ pub async fn download_testfiles(project_root: &Path) {
|
||||||
player(&testfiles).await;
|
player(&testfiles).await;
|
||||||
player_model(&testfiles).await;
|
player_model(&testfiles).await;
|
||||||
playlist(&testfiles).await;
|
playlist(&testfiles).await;
|
||||||
|
playlist_cont(&testfiles).await;
|
||||||
video_details(&testfiles).await;
|
video_details(&testfiles).await;
|
||||||
comments_top(&testfiles).await;
|
comments_top(&testfiles).await;
|
||||||
comments_latest(&testfiles).await;
|
comments_latest(&testfiles).await;
|
||||||
|
|
@ -141,6 +142,25 @@ async fn playlist(testfiles: &Path) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn playlist_cont(testfiles: &Path) {
|
||||||
|
let mut json_path = testfiles.to_path_buf();
|
||||||
|
json_path.push("playlist");
|
||||||
|
json_path.push("playlist_cont.json");
|
||||||
|
if json_path.exists() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let rp = RustyPipe::new();
|
||||||
|
let playlist = rp
|
||||||
|
.query()
|
||||||
|
.playlist("PL5dDx681T4bR7ZF1IuWzOv1omlRbE7PiJ")
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let rp = rp_testfile(&json_path);
|
||||||
|
playlist.videos.next(rp.query()).await.unwrap().unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
async fn video_details(testfiles: &Path) {
|
async fn video_details(testfiles: &Path) {
|
||||||
for (name, id) in [
|
for (name, id) in [
|
||||||
("music", "XuM2onMGvTI"),
|
("music", "XuM2onMGvTI"),
|
||||||
|
|
|
||||||
|
|
@ -252,4 +252,21 @@ mod tests {
|
||||||
".last_update" => "[date]"
|
".last_update" => "[date]"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn map_playlist_cont() {
|
||||||
|
let json_path = Path::new("testfiles/playlist/playlist_cont.json");
|
||||||
|
let json_file = File::open(json_path).unwrap();
|
||||||
|
|
||||||
|
let playlist: response::PlaylistCont =
|
||||||
|
serde_json::from_reader(BufReader::new(json_file)).unwrap();
|
||||||
|
let map_res = playlist.map_response("", Language::En, None).unwrap();
|
||||||
|
|
||||||
|
assert!(
|
||||||
|
map_res.warnings.is_empty(),
|
||||||
|
"deserialization/mapping warnings: {:?}",
|
||||||
|
map_res.warnings
|
||||||
|
);
|
||||||
|
insta::assert_ron_snapshot!("map_playlist_cont", map_res.c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
20489
testfiles/playlist/playlist_cont.json
Normal file
20489
testfiles/playlist/playlist_cont.json
Normal file
File diff suppressed because it is too large
Load diff
Reference in a new issue