From 8d2bcfe6945c6fa3b33dae01ffa8dfb18c3fe9d4 Mon Sep 17 00:00:00 2001 From: Mingwei Samuel Date: Mon, 27 Sep 2021 19:38:20 -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 --- riven/src/endpoints.rs | 2 +- riven/src/meta.rs | 2 +- riven/src/models.rs | 6 +++--- riven/tests/async_tests.rs | 2 +- riven/tests/tests_americas.rs | 24 ++++++++++++++++++++++++ 5 files changed, 30 insertions(+), 6 deletions(-) diff --git a/riven/src/endpoints.rs b/riven/src/endpoints.rs index 695e2d8..9012635 100644 --- a/riven/src/endpoints.rs +++ b/riven/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/riven/src/meta.rs b/riven/src/meta.rs index bad9ce6..64fa929 100644 --- a/riven/src/meta.rs +++ b/riven/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/riven/src/models.rs b/riven/src/models.rs index 9ae616b..e7764a5 100644 --- a/riven/src/models.rs +++ b/riven/src/models.rs @@ -7,7 +7,7 @@ /////////////////////////////////////////////// // http://www.mingweisamuel.com/riotapi-schema/tool/ -// Version 0715d17267a9bec35845651ad3fb702c5bcbdaa1 +// Version f4a77c89fedf1b9e2d8ff0897e2779ef549aaccf //! Data transfer structs. //! @@ -745,10 +745,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/riven/tests/async_tests.rs b/riven/tests/async_tests.rs index e2432a4..fdfc4de 100644 --- a/riven/tests/async_tests.rs +++ b/riven/tests/async_tests.rs @@ -65,7 +65,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/riven/tests/tests_americas.rs b/riven/tests/tests_americas.rs index 0f1b9d4..28c23be 100644 --- a/riven/tests/tests_americas.rs +++ b/riven/tests/tests_americas.rs @@ -12,6 +12,8 @@ use riven::models::tournament_stub_v4::*; const ROUTE: RegionalRoute = RegionalRoute::AMERICAS; +static MATCHES: [&'static str; 3] = [ "NA1_3923487226", "NA1_4049206905", "NA1_4052515784" ]; + async_tests!{ my_runner { // Champion Mastery tests. @@ -59,5 +61,27 @@ async_tests!{ } } }, + + match_v5_get: async { + for matche in MATCHES { + let p = RIOT_API.match_v5().get_match(ROUTE, 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(ROUTE, 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(()) + }, } }