forked from mirror/Riven
1
0
Fork 0
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/ // http://www.mingweisamuel.com/riotapi-schema/tool/
// Version 0715d17267a9bec35845651ad3fb702c5bcbdaa1 // Version f4a77c89fedf1b9e2d8ff0897e2779ef549aaccf
//! Automatically generated endpoint handles. //! Automatically generated endpoint handles.

View File

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

View File

@ -7,7 +7,7 @@
/////////////////////////////////////////////// ///////////////////////////////////////////////
// http://www.mingweisamuel.com/riotapi-schema/tool/ // http://www.mingweisamuel.com/riotapi-schema/tool/
// Version 0715d17267a9bec35845651ad3fb702c5bcbdaa1 // Version f4a77c89fedf1b9e2d8ff0897e2779ef549aaccf
//! Data transfer structs. //! Data transfer structs.
//! //!
@ -739,10 +739,10 @@ pub mod match_v5 {
#[derive(serde::Serialize, serde::Deserialize)] #[derive(serde::Serialize, serde::Deserialize)]
pub struct Metadata { pub struct Metadata {
/// Match data version. /// Match data version.
#[serde(rename = "data_version")] #[serde(rename = "dataVersion")]
pub data_version: String, pub data_version: String,
/// Match id. /// Match id.
#[serde(rename = "match_id")] #[serde(rename = "matchId")]
pub match_id: String, pub match_id: String,
/// A list of participant PUUIDs. /// A list of participant PUUIDs.
#[serde(rename = "participants")] #[serde(rename = "participants")]

View File

@ -68,7 +68,7 @@ macro_rules! rassert {
}; };
( $x:expr, $format:expr $(, $arg:expr)* ) => { ( $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 async_tests;
mod testutils; mod testutils;
// use testutils::*; use testutils::*;
use colored::*; use colored::*;
// use riven::consts::*; use riven::consts::*;
static MATCHES: [&'static str; 3] = [ "NA1_3923487226", "NA1_4049206905", "NA1_4052515784" ];
async_tests!{ async_tests!{
my_runner { my_runner {
// DISABLED FOR API KEY ACCESS. match_v5_get: async {
// match_v5_get: async { for matche in MATCHES {
// let p = RIOT_API.match_v5().get_match(Region::AMERICAS, "NA1_3923487226"); let p = RIOT_API.match_v5().get_match(Region::AMERICAS, matche);
// let m = p.await.map_err(|e| e.to_string())?.ok_or("Match not found.".to_owned())?; let m = p.await.map_err(|e| e.to_string())?.ok_or(format!("Match {} not found.", matche))?;
// rassert_eq!("NA1_3923487226", m.metadata.match_id, "Bad match id? {}", m.metadata.match_id); 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.metadata.participants.is_empty(), "Match should have participants.");
// rassert!(!m.info.teams.is_empty(), "Match should have teams."); rassert!(!m.info.teams.is_empty(), "Match should have teams.");
// Ok(()) }
// }, 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(())
},
} }
} }