resource response Addons deserializing test fixed
use crate::types::addon::ResourceResponse;
-use crate::types::addon::{DescriptorPreview, ManifestPreview};
use crate::types::resource::{
Link, MetaItem, MetaItemBehaviorHints, PosterShape, SeriesInfo, Stream, StreamSource,
Subtitles, Video,
};
use chrono::prelude::TimeZone;
use chrono::Utc;
-use semver::Version;
use url::Url;
#[test]
@@ -310,66 +308,15 @@ fn deserialize_resource_response_subtitles() {
#[test]
fn deserialize_resource_response_addons() {
- let descriptor_previews = vec![
- DescriptorPreview {
- manifest: ManifestPreview {
- id: "id1".to_owned(),
- version: Version::new(0, 0, 1),
- name: "name".to_owned(),
- description: Some("description".to_owned()),
- logo: Some("logo".to_owned()),
- background: Some("background".to_owned()),
- types: vec!["type".to_owned()],
- },
- transport_url: Url::parse("https://transport_url").unwrap(),
- },
- DescriptorPreview {
- manifest: ManifestPreview {
- id: "id2".to_owned(),
- version: Version::new(0, 0, 1),
- name: "name".to_owned(),
- description: None,
- logo: None,
- background: None,
- types: vec![],
- },
- transport_url: Url::parse("https://transport_url").unwrap(),
- },
- ];
- let descriptor_previews_json = r#"
- [
+ let addons = ResourceResponse::Addons { addons: vec![] };
+ let addons_json = r#"
{
- "manifest": {
- "id": "id1",
- "version": "0.0.1",
- "name": "name",
- "description": "description",
- "logo": "logo",
- "background": "background",
- "types": [
- "type"
- ]
- },
- "transportUrl": "https://transport_url"
- },
- {
- "manifest": {
- "id": "id2",
- "version": "0.0.1",
- "name": "name",
- "description": null,
- "logo": null,
- "background": null,
- "types": []
- },
- "transportUrl": "https://transport_url"
+ "addons": []
}
- ]
"#;
- let descriptor_previews_deserialize: Vec<DescriptorPreview> =
- serde_json::from_str(&descriptor_previews_json).unwrap();
+ let addons_deserialize = serde_json::from_str(&addons_json).unwrap();
assert_eq!(
- descriptor_previews, descriptor_previews_deserialize,
- "descriptor previews deserialized successfully"
+ addons, addons_deserialize,
+ "Addons deserialized successfully"
);
}
