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
This commit is contained in:
Mingwei Samuel 2021-09-27 19:26:18 -07:00
parent 35d32eeb24
commit efbd101e83
5 changed files with 31 additions and 17 deletions

View file

@ -7,7 +7,7 @@
///////////////////////////////////////////////
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version 0715d17267a9bec35845651ad3fb702c5bcbdaa1
// Version f4a77c89fedf1b9e2d8ff0897e2779ef549aaccf
//! Automatically generated endpoint handles.

View file

@ -7,7 +7,7 @@
///////////////////////////////////////////////
// http://www.mingweisamuel.com/riotapi-schema/tool/
// Version 0715d17267a9bec35845651ad3fb702c5bcbdaa1
// Version f4a77c89fedf1b9e2d8ff0897e2779ef549aaccf
//! Metadata about the Riot API and Riven.
//!

View file

@ -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")]

View file

@ -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 )* ) ) }?
}
};
}

View file

@ -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(())
},
}
}