tests: fix tests
This commit is contained in:
parent
745ee01067
commit
c879dcf934
4 changed files with 37 additions and 34 deletions
|
|
@ -79,9 +79,11 @@ pub(crate) struct MusicCardShelf {
|
|||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[allow(clippy::enum_variant_names)]
|
||||
pub(crate) enum MusicResponseItem {
|
||||
MusicResponsiveListItemRenderer(ListMusicItem),
|
||||
MusicTwoRowItemRenderer(CoverMusicItem),
|
||||
MessageRenderer(serde::de::IgnoredAny),
|
||||
}
|
||||
|
||||
#[serde_as]
|
||||
|
|
@ -910,6 +912,7 @@ impl MusicListMapper {
|
|||
None => Err("could not determine item type".to_owned()),
|
||||
}
|
||||
}
|
||||
MusicResponseItem::MessageRenderer(_) => Ok(None),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ MusicAlbum(
|
|||
TrackItem(
|
||||
id: "g0iRiJ_ck48",
|
||||
name: "Aulë und Yavanna",
|
||||
duration: Some(216),
|
||||
duration: Some(217),
|
||||
cover: [],
|
||||
artists: [
|
||||
ArtistId(
|
||||
|
|
@ -43,7 +43,7 @@ MusicAlbum(
|
|||
TrackItem(
|
||||
id: "rREEBXp0y9s",
|
||||
name: "Numenor",
|
||||
duration: Some(224),
|
||||
duration: Some(225),
|
||||
cover: [],
|
||||
artists: [
|
||||
ArtistId(
|
||||
|
|
@ -64,7 +64,7 @@ MusicAlbum(
|
|||
TrackItem(
|
||||
id: "zvU5Y8Q19hU",
|
||||
name: "Das Mädchen und die Liebe (feat. Santiano)",
|
||||
duration: Some(176),
|
||||
duration: Some(177),
|
||||
cover: [],
|
||||
artists: [
|
||||
ArtistId(
|
||||
|
|
@ -85,7 +85,7 @@ MusicAlbum(
|
|||
TrackItem(
|
||||
id: "ARKLrzzTQA0",
|
||||
name: "Niënna",
|
||||
duration: Some(215),
|
||||
duration: Some(216),
|
||||
cover: [],
|
||||
artists: [
|
||||
ArtistId(
|
||||
|
|
@ -106,7 +106,7 @@ MusicAlbum(
|
|||
TrackItem(
|
||||
id: "tstLgN8A_Ng",
|
||||
name: "Der fahle Mond",
|
||||
duration: Some(268),
|
||||
duration: Some(269),
|
||||
cover: [],
|
||||
artists: [
|
||||
ArtistId(
|
||||
|
|
@ -127,7 +127,7 @@ MusicAlbum(
|
|||
TrackItem(
|
||||
id: "k2DjgQOY3Ts",
|
||||
name: "Weise den Weg",
|
||||
duration: Some(202),
|
||||
duration: Some(203),
|
||||
cover: [],
|
||||
artists: [
|
||||
ArtistId(
|
||||
|
|
@ -148,7 +148,7 @@ MusicAlbum(
|
|||
TrackItem(
|
||||
id: "azHwhecxEsI",
|
||||
name: "Zeit der Sommernächte",
|
||||
duration: Some(185),
|
||||
duration: Some(186),
|
||||
cover: [],
|
||||
artists: [
|
||||
ArtistId(
|
||||
|
|
@ -169,7 +169,7 @@ MusicAlbum(
|
|||
TrackItem(
|
||||
id: "_FcsdYIQ2co",
|
||||
name: "Märchen enden gut",
|
||||
duration: Some(226),
|
||||
duration: Some(227),
|
||||
cover: [],
|
||||
artists: [
|
||||
ArtistId(
|
||||
|
|
@ -190,7 +190,7 @@ MusicAlbum(
|
|||
TrackItem(
|
||||
id: "27bOWEbshyE",
|
||||
name: "Das Mädchen und der Tod",
|
||||
duration: Some(207),
|
||||
duration: Some(208),
|
||||
cover: [],
|
||||
artists: [
|
||||
ArtistId(
|
||||
|
|
@ -211,7 +211,7 @@ MusicAlbum(
|
|||
TrackItem(
|
||||
id: "riD_3oZwt8w",
|
||||
name: "Wir sehn uns wieder",
|
||||
duration: Some(211),
|
||||
duration: Some(212),
|
||||
cover: [],
|
||||
artists: [
|
||||
ArtistId(
|
||||
|
|
@ -232,7 +232,7 @@ MusicAlbum(
|
|||
TrackItem(
|
||||
id: "8GNvjF3no9s",
|
||||
name: "Tanz mit mir",
|
||||
duration: Some(179),
|
||||
duration: Some(180),
|
||||
cover: [],
|
||||
artists: [
|
||||
ArtistId(
|
||||
|
|
@ -253,7 +253,7 @@ MusicAlbum(
|
|||
TrackItem(
|
||||
id: "YHMFzf1uN2U",
|
||||
name: "Nachtigall",
|
||||
duration: Some(218),
|
||||
duration: Some(219),
|
||||
cover: [],
|
||||
artists: [
|
||||
ArtistId(
|
||||
|
|
@ -274,7 +274,7 @@ MusicAlbum(
|
|||
TrackItem(
|
||||
id: "jvV-z5F3oAo",
|
||||
name: "Gayatri Mantra",
|
||||
duration: Some(277),
|
||||
duration: Some(278),
|
||||
cover: [],
|
||||
artists: [
|
||||
ArtistId(
|
||||
|
|
@ -295,7 +295,7 @@ MusicAlbum(
|
|||
TrackItem(
|
||||
id: "u8_9cxlrh8k",
|
||||
name: "Sing mir deine Lieder",
|
||||
duration: Some(204),
|
||||
duration: Some(205),
|
||||
cover: [],
|
||||
artists: [
|
||||
ArtistId(
|
||||
|
|
@ -316,7 +316,7 @@ MusicAlbum(
|
|||
TrackItem(
|
||||
id: "gSvKcvM1Wk0",
|
||||
name: "Laurië lantar",
|
||||
duration: Some(202),
|
||||
duration: Some(203),
|
||||
cover: [],
|
||||
artists: [
|
||||
ArtistId(
|
||||
|
|
@ -337,7 +337,7 @@ MusicAlbum(
|
|||
TrackItem(
|
||||
id: "wQHgKRJ0pDQ",
|
||||
name: "Wächter vor dem Tor",
|
||||
duration: Some(222),
|
||||
duration: Some(223),
|
||||
cover: [],
|
||||
artists: [
|
||||
ArtistId(
|
||||
|
|
@ -358,7 +358,7 @@ MusicAlbum(
|
|||
TrackItem(
|
||||
id: "Ckz5i6-hzf0",
|
||||
name: "Stroh zu Gold",
|
||||
duration: Some(177),
|
||||
duration: Some(178),
|
||||
cover: [],
|
||||
artists: [
|
||||
ArtistId(
|
||||
|
|
@ -379,7 +379,7 @@ MusicAlbum(
|
|||
TrackItem(
|
||||
id: "y5zuUgyFqrc",
|
||||
name: "Sonnenwendnacht",
|
||||
duration: Some(220),
|
||||
duration: Some(221),
|
||||
cover: [],
|
||||
artists: [
|
||||
ArtistId(
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ MusicArtist(
|
|||
id: "UC7cl4MmM6ZZ2TcFyMk_b4pg",
|
||||
name: "Unheilig",
|
||||
header_image: "[header_image]",
|
||||
description: Some("Unheilig was a German band that featured a variety of influences, including various pop and electronic styles as well as harder, nihilistic hard rock. The band was founded in 1999 and principally consisted of singer Bernd Heinrich \"Der Graf\" along with various musical partners. He was accompanied for live shows with musicians Christoph \"Licky\" Termühlen, Henning Verlage, and Martin \"Potti\" Potthoff. The group\'s debut, Phosphor, came out in 2000.\n\nFrom Wikipedia (https://en.wikipedia.org/wiki/Unheilig) under Creative Commons Attribution CC-BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/legalcode)"),
|
||||
description: Some("Unheilig is a German band that draws from a variety of influences, including various pop and electronic styles as well as heavier, nihilistic hard rock. The band was founded in Aachen in 1999 and principally consisted of singer Bernd Heinrich \"Der Graf\" along with various musical partners. He was accompanied for live shows with musicians Christoph \"Licky\" Termühlen, Henning Verlage, and Martin \"Potti\" Potthoff. The group\'s debut, Phosphor, came out in 2000.\n\nFrom Wikipedia (https://en.wikipedia.org/wiki/Unheilig) under Creative Commons Attribution CC-BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/legalcode)"),
|
||||
wikipedia_url: Some("https://en.wikipedia.org/wiki/Unheilig"),
|
||||
subscriber_count: "[subscriber_count]",
|
||||
tracks: "[tracks]",
|
||||
|
|
|
|||
|
|
@ -178,13 +178,13 @@ fn check_video_stream(s: impl YtStream) {
|
|||
false
|
||||
)]
|
||||
#[case::live(
|
||||
"86YLFOog4GM",
|
||||
"🌎 Earth From Space Live Stream : Live Views from the ISS",
|
||||
"The station is crewed by NASA astronauts as well as Russian Cosmonauts",
|
||||
"jfKfPfyJRdk",
|
||||
"lofi hip hop radio 📚 - beats to relax/study to",
|
||||
"Listen on Spotify, Apple music and more",
|
||||
0,
|
||||
"UCakgsb0w7QB0VHdnCc-OVEA",
|
||||
"Space Videos",
|
||||
10,
|
||||
"UCSJ4gkVC6NrvII8umztf0Ow",
|
||||
"Lofi Girl",
|
||||
100,
|
||||
true,
|
||||
true
|
||||
)]
|
||||
|
|
@ -661,23 +661,23 @@ fn get_video_details_chapters(rp: RustyPipe) {
|
|||
|
||||
#[rstest]
|
||||
fn get_video_details_live(rp: RustyPipe) {
|
||||
let details = tokio_test::block_on(rp.query().video_details("86YLFOog4GM")).unwrap();
|
||||
let details = tokio_test::block_on(rp.query().video_details("jfKfPfyJRdk")).unwrap();
|
||||
|
||||
// dbg!(&details);
|
||||
|
||||
assert_eq!(details.id, "86YLFOog4GM");
|
||||
assert_eq!(details.id, "jfKfPfyJRdk");
|
||||
assert_eq!(
|
||||
details.name,
|
||||
"🌎 Earth From Space Live Stream : Live Views from the ISS"
|
||||
"lofi hip hop radio 📚 - beats to relax/study to"
|
||||
);
|
||||
let desc = details.description.to_plaintext();
|
||||
assert!(
|
||||
desc.contains("The station is crewed by NASA astronauts as well as Russian Cosmonauts"),
|
||||
desc.contains("Listen on Spotify, Apple music and more"),
|
||||
"bad description: {desc}"
|
||||
);
|
||||
|
||||
assert_eq!(details.channel.id, "UCakgsb0w7QB0VHdnCc-OVEA");
|
||||
assert_eq!(details.channel.name, "Space Videos");
|
||||
assert_eq!(details.channel.id, "UCSJ4gkVC6NrvII8umztf0Ow");
|
||||
assert_eq!(details.channel.name, "Lofi Girl");
|
||||
assert!(!details.channel.avatar.is_empty(), "no channel avatars");
|
||||
assert_eq!(details.channel.verification, Verification::Verified);
|
||||
assert_gte(
|
||||
|
|
@ -685,11 +685,11 @@ fn get_video_details_live(rp: RustyPipe) {
|
|||
5_500_000,
|
||||
"subscribers",
|
||||
);
|
||||
assert_gte(details.view_count, 10, "views");
|
||||
assert_gte(details.like_count.unwrap(), 872_290, "likes");
|
||||
assert_gte(details.view_count, 100, "views");
|
||||
assert_gte(details.like_count.unwrap(), 1_800_000, "likes");
|
||||
|
||||
let date = details.publish_date.unwrap();
|
||||
assert_eq!(date.date(), date!(2021 - 9 - 23));
|
||||
assert_eq!(date.date(), date!(2022 - 7 - 12));
|
||||
|
||||
assert!(details.is_live);
|
||||
assert!(!details.is_ccommons);
|
||||
|
|
|
|||
Reference in a new issue