use std::collections::HashMap;
use serde::{Deserialize, Serialize};
use crate::{meta::Meta, set::Set};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AllPrintings {
pub meta: Meta,
pub data: HashMap<String, Set>,
}
#[cfg(test)]
mod tests {
use super::*;
use std::fs::File;
use std::io::BufReader;
#[cfg_attr(not(feature = "local_tests"), ignore)]
#[test]
fn test_all_printings_local() {
let file = File::open("testdata/AllPrintings.json").unwrap();
let reader = BufReader::new(file);
let _: AllPrintings = serde_json::from_reader(reader).unwrap();
}
#[cfg_attr(not(feature = "network_tests"), ignore)]
#[test]
fn test_all_printings_network() {
let _: AllPrintings =
reqwest::blocking::get("https://mtgjson.com/api/v5/AllPrintings.json")
.unwrap()
.json()
.unwrap();
}
}