mirror of
https://github.com/euzu/tuliprox.git
synced 2026-10-17 13:22:19 +02:00
@@ -617,7 +617,6 @@ mod tests {
|
||||
use crate::model::{EpgSmartMatchConfig, PersistedEpgSource, TVGuide};
|
||||
use crate::processing::parser::xmltv::normalize_channel_name;
|
||||
use std::collections::HashSet;
|
||||
use std::io;
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[test]
|
||||
@@ -636,9 +635,9 @@ mod tests {
|
||||
}
|
||||
|
||||
|
||||
#[ignore]
|
||||
#[ignore = "requires a local XMLTV fixture under /tmp"]
|
||||
#[test]
|
||||
fn parse_test() -> io::Result<()> {
|
||||
fn parse_test() {
|
||||
let run_test = async move || {
|
||||
//let file_path = PathBuf::from("/tmp/epg.xml.gz");
|
||||
let file_path = PathBuf::from("/tmp/invalid_epg.xml");
|
||||
@@ -652,19 +651,18 @@ mod tests {
|
||||
|
||||
let channel_ids = HashSet::from([342u32.intern()]);
|
||||
match tv_guide.filter(&mut id_cache).await {
|
||||
None => assert!(false, "No epg filtered"),
|
||||
None => panic!("No epg filtered"),
|
||||
Some(epgs) => {
|
||||
for epg in epgs {
|
||||
assert_eq!(epg.children.len(), channel_ids.len() * 2, "Epg size does not match")
|
||||
assert_eq!(epg.children.len(), channel_ids.len() * 2, "Epg size does not match");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
let _result = tokio::runtime::Runtime::new()
|
||||
tokio::runtime::Runtime::new()
|
||||
.unwrap()
|
||||
.block_on(run_test());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -725,4 +723,4 @@ mod tests {
|
||||
println!("{}", metaphone.encode(&normalize_channel_name("BU | ODISEA ᵁᴴᴰ ³⁸⁴⁰ᴾ", &epg_smart_cfg)));
|
||||
println!("{}", metaphone.encode(&normalize_channel_name("BG | ODISEA ᵁᴴᴰ ³⁸⁴⁰ᴾ", &epg_smart_cfg)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -387,11 +387,10 @@ mod tests {
|
||||
let file_content = fs::read_to_string("/tmp/series-info.json").expect("Unable to read file");
|
||||
match serde_json::from_str::<XtreamSeriesInfo>(&file_content) {
|
||||
Ok(series_info) => {
|
||||
println!("{:#?}", series_info);
|
||||
assert!(true);
|
||||
println!("{series_info:#?}");
|
||||
}
|
||||
Err(err) => {
|
||||
assert!(false, "Failed to parse json file: {err}");
|
||||
panic!("Failed to parse json file: {err}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -402,14 +401,13 @@ mod tests {
|
||||
if fs::exists("/tmp/vod_streams.json").unwrap_or(false) {
|
||||
let reader = Box::pin(async_file_reader(tokio::fs::File::open("/tmp/vod_streams.json").await?));
|
||||
match map_to_xtream_streams(XtreamCluster::Video, reader, &"test".intern()).await {
|
||||
Ok(_streams) => {
|
||||
println!("{:?}", _streams.get(1));
|
||||
println!("{:?}", _streams.get(100));
|
||||
println!("{:?}", _streams.get(200));
|
||||
assert!(true);
|
||||
Ok(streams) => {
|
||||
println!("{:?}", streams.get(1));
|
||||
println!("{:?}", streams.get(100));
|
||||
println!("{:?}", streams.get(200));
|
||||
}
|
||||
Err(err) => {
|
||||
assert!(false, "Failed to parse json file: {err}");
|
||||
panic!("Failed to parse json file: {err}");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ mod tests {
|
||||
.map(|(i, (name, quality))| PlaylistItem {
|
||||
header: PlaylistItemHeader {
|
||||
title: format!("Chanel {name} [{quality}]").into(),
|
||||
source_ordinal: i as u32,
|
||||
source_ordinal: u32::try_from(i).unwrap(),
|
||||
..Default::default()
|
||||
},
|
||||
})
|
||||
@@ -313,10 +313,10 @@ mod tests {
|
||||
let ord =
|
||||
playlist_comparator(channel_sort.sequence.as_ref(), channel_sort.order, va, vb);
|
||||
|
||||
if ord != Ordering::Equal {
|
||||
ord
|
||||
} else {
|
||||
if ord == Ordering::Equal {
|
||||
a.header.source_ordinal.cmp(&b.header.source_ordinal)
|
||||
} else {
|
||||
ord
|
||||
}
|
||||
});
|
||||
|
||||
@@ -376,7 +376,7 @@ mod tests {
|
||||
.map(|(i, name)| PlaylistItem {
|
||||
header: PlaylistItemHeader {
|
||||
title: name.to_string().into(),
|
||||
source_ordinal: i as u32,
|
||||
source_ordinal: u32::try_from(i).unwrap(),
|
||||
..Default::default()
|
||||
},
|
||||
})
|
||||
@@ -407,10 +407,10 @@ mod tests {
|
||||
&b.header.title,
|
||||
);
|
||||
|
||||
if ord != Ordering::Equal {
|
||||
ord
|
||||
} else {
|
||||
if ord == Ordering::Equal {
|
||||
a.header.source_ordinal.cmp(&b.header.source_ordinal)
|
||||
} else {
|
||||
ord
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user