From efbd101e83e04e82a05749590bb6cf819d7cc439 Mon Sep 17 00:00:00 2001 From: Mingwei Samuel Date: Mon, 27 Sep 2021 19:26:18 -0700 Subject: [PATCH] Regen for match-v5.MatchInfoDto docs casing fix, update tests - https://github.com/RiotGames/developer-relations/issues/540 = https://github.com/MingweiSamuel/riotapi-schema/issues/28 --- src/endpoints.rs | 2 +- src/meta.rs | 2 +- src/models.rs | 6 +++--- tests/async_tests.rs | 2 +- tests/tests_americas.rs | 36 +++++++++++++++++++++++++----------- 5 files changed, 31 insertions(+), 17 deletions(-) diff --git a/src/endpoints.rs b/src/endpoints.rs index 25a8e4a..1aebcfe 100644 --- a/src/endpoints.rs +++ b/src/endpoints.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version 0715d17267a9bec35845651ad3fb702c5bcbdaa1 +// Version f4a77c89fedf1b9e2d8ff0897e2779ef549aaccf //! Automatically generated endpoint handles. diff --git a/src/meta.rs b/src/meta.rs index a6afe7d..93da8ac 100644 --- a/src/meta.rs +++ b/src/meta.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version 0715d17267a9bec35845651ad3fb702c5bcbdaa1 +// Version f4a77c89fedf1b9e2d8ff0897e2779ef549aaccf //! Metadata about the Riot API and Riven. //! diff --git a/src/models.rs b/src/models.rs index d356d4b..85c4fd5 100644 --- a/src/models.rs +++ b/src/models.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version 0715d17267a9bec35845651ad3fb702c5bcbdaa1 +// Version f4a77c89fedf1b9e2d8ff0897e2779ef549aaccf //! Data transfer structs. //! @@ -739,10 +739,10 @@ pub mod match_v5 { #[derive(serde::Serialize, serde::Deserialize)] pub struct Metadata { /// Match data version. - #[serde(rename = "data_version")] + #[serde(rename = "dataVersion")] pub data_version: String, /// Match id. - #[serde(rename = "match_id")] + #[serde(rename = "matchId")] pub match_id: String, /// A list of participant PUUIDs. #[serde(rename = "participants")] diff --git a/tests/async_tests.rs b/tests/async_tests.rs index 0e63c69..6544f99 100644 --- a/tests/async_tests.rs +++ b/tests/async_tests.rs @@ -68,7 +68,7 @@ macro_rules! rassert { }; ( $x:expr, $format:expr $(, $arg:expr)* ) => { { - if $x { Ok(()) } else { Err( format!($format, $( $arg )* ) ) }? + if $x { Ok(()) } else { Err( format!($format $(, $arg )* ) ) }? } }; } diff --git a/tests/tests_americas.rs b/tests/tests_americas.rs index 7602b72..5c8a502 100644 --- a/tests/tests_americas.rs +++ b/tests/tests_americas.rs @@ -3,22 +3,36 @@ mod async_tests; mod testutils; -// use testutils::*; +use testutils::*; use colored::*; -// use riven::consts::*; +use riven::consts::*; + +static MATCHES: [&'static str; 3] = [ "NA1_3923487226", "NA1_4049206905", "NA1_4052515784" ]; async_tests!{ my_runner { - // DISABLED FOR API KEY ACCESS. - // match_v5_get: async { - // let p = RIOT_API.match_v5().get_match(Region::AMERICAS, "NA1_3923487226"); - // let m = p.await.map_err(|e| e.to_string())?.ok_or("Match not found.".to_owned())?; - // rassert_eq!("NA1_3923487226", m.metadata.match_id, "Bad match id? {}", m.metadata.match_id); - // rassert!(!m.metadata.participants.is_empty(), "Match should have participants."); - // rassert!(!m.info.teams.is_empty(), "Match should have teams."); - // Ok(()) - // }, + match_v5_get: async { + for matche in MATCHES { + let p = RIOT_API.match_v5().get_match(Region::AMERICAS, matche); + let m = p.await.map_err(|e| e.to_string())?.ok_or(format!("Match {} not found.", matche))?; + rassert_eq!(matche, m.metadata.match_id, "Bad match id? Sent {}, received {}.", matche, m.metadata.match_id); + rassert!(!m.metadata.participants.is_empty(), "Match should have participants."); + rassert!(!m.info.teams.is_empty(), "Match should have teams."); + } + Ok(()) + }, + match_v5_get_timeline: async { + for matche in MATCHES { + let p = RIOT_API.match_v5().get_timeline(Region::AMERICAS, matche); + let m = p.await.map_err(|e| e.to_string())?.ok_or(format!("Match timeline {} not found.", matche))?; + rassert_eq!(matche, m.metadata.match_id, "Bad match id? Sent {}, received {}.", matche, m.metadata.match_id); + rassert!(!m.metadata.participants.is_empty(), "Match should have participants."); + rassert_eq!(matche, format!("NA1_{}", m.info.game_id), "Match number ID should match."); + rassert!(!m.info.frames.is_empty(), "Match timleine should have frames."); + } + Ok(()) + }, } }