mirror of
https://github.com/MingweiSamuel/Riven.git
synced 2024-12-27 03:16:33 +00:00
Regen and add lol-challenges-v1.getAllChallengeConfigs
and .getChallengeConfigs
test
This commit is contained in:
parent
03a053d142
commit
b821314492
4 changed files with 33 additions and 9 deletions
|
@ -7,7 +7,7 @@
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
|
|
||||||
// http://www.mingweisamuel.com/riotapi-schema/tool/
|
// http://www.mingweisamuel.com/riotapi-schema/tool/
|
||||||
// Version d2e2d8db61e32b60f6722b887694538659c20436
|
// Version 4969d1e8bcccde31f0dfc173cfb49652bea2b35c
|
||||||
|
|
||||||
//! Automatically generated endpoint handles.
|
//! Automatically generated endpoint handles.
|
||||||
#![allow(clippy::let_and_return, clippy::too_many_arguments)]
|
#![allow(clippy::let_and_return, clippy::too_many_arguments)]
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
|
|
||||||
// http://www.mingweisamuel.com/riotapi-schema/tool/
|
// http://www.mingweisamuel.com/riotapi-schema/tool/
|
||||||
// Version d2e2d8db61e32b60f6722b887694538659c20436
|
// Version 4969d1e8bcccde31f0dfc173cfb49652bea2b35c
|
||||||
|
|
||||||
//! Metadata about the Riot API and Riven.
|
//! Metadata about the Riot API and Riven.
|
||||||
//!
|
//!
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
|
|
||||||
// http://www.mingweisamuel.com/riotapi-schema/tool/
|
// http://www.mingweisamuel.com/riotapi-schema/tool/
|
||||||
// Version d2e2d8db61e32b60f6722b887694538659c20436
|
// Version 4969d1e8bcccde31f0dfc173cfb49652bea2b35c
|
||||||
|
|
||||||
#![allow(missing_docs)]
|
#![allow(missing_docs)]
|
||||||
|
|
||||||
|
@ -380,14 +380,19 @@ pub mod lol_challenges_v1 {
|
||||||
pub id: i64,
|
pub id: i64,
|
||||||
#[serde(rename = "localizedNames")]
|
#[serde(rename = "localizedNames")]
|
||||||
pub localized_names: std::collections::HashMap<String, std::collections::HashMap<String, String>>,
|
pub localized_names: std::collections::HashMap<String, std::collections::HashMap<String, String>>,
|
||||||
|
/// DISABLED - not visible and not calculated, HIDDEN - not visible, but calculated, ENABLED - visible and calculated, ARCHIVED - visible, but not calculated
|
||||||
#[serde(rename = "state")]
|
#[serde(rename = "state")]
|
||||||
pub state: State,
|
pub state: String,
|
||||||
|
/// LIFETIME - stats are incremented without reset, SEASON - stats are accumulated by season and reset at the beginning of new season
|
||||||
#[serde(rename = "tracking")]
|
#[serde(rename = "tracking")]
|
||||||
pub tracking: Tracking,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub tracking: Option<String>,
|
||||||
#[serde(rename = "startTimestamp")]
|
#[serde(rename = "startTimestamp")]
|
||||||
pub start_timestamp: i64,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub start_timestamp: Option<i64>,
|
||||||
#[serde(rename = "endTimestamp")]
|
#[serde(rename = "endTimestamp")]
|
||||||
pub end_timestamp: i64,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub end_timestamp: Option<i64>,
|
||||||
#[serde(rename = "leaderboard")]
|
#[serde(rename = "leaderboard")]
|
||||||
pub leaderboard: bool,
|
pub leaderboard: bool,
|
||||||
#[serde(rename = "thresholds")]
|
#[serde(rename = "thresholds")]
|
||||||
|
|
|
@ -13,6 +13,25 @@ const ROUTE: PlatformRoute = PlatformRoute::LA1;
|
||||||
|
|
||||||
async_tests! {
|
async_tests! {
|
||||||
my_runner {
|
my_runner {
|
||||||
|
lol_challenges_v1_check_configs: async {
|
||||||
|
let challenges = RIOT_API.lol_challenges_v1().get_all_challenge_configs(ROUTE)
|
||||||
|
.await.map_err(|e| e.to_string())?;
|
||||||
|
rassert!(!challenges.is_empty());
|
||||||
|
|
||||||
|
for challenge in challenges.iter() {
|
||||||
|
rassert!(!challenge.localized_names.is_empty());
|
||||||
|
rassert!(!challenge.thresholds.is_empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Spot-check 10% of the challenge IDs.
|
||||||
|
for challenge in challenges.iter().step_by(10) {
|
||||||
|
RIOT_API.lol_challenges_v1().get_challenge_configs(ROUTE, challenge.id)
|
||||||
|
.await.map_err(|e| format!("Failed to get challenge config with id {}\n{}", challenge.id, e))?
|
||||||
|
.ok_or_else(|| format!("Challenge config with id {} returned 404", challenge.id))?;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
},
|
||||||
lol_challenges_v1_check_percentiles: async {
|
lol_challenges_v1_check_percentiles: async {
|
||||||
// Check all percentiles.
|
// Check all percentiles.
|
||||||
let percentiles = RIOT_API.lol_challenges_v1().get_all_challenge_percentiles(ROUTE)
|
let percentiles = RIOT_API.lol_challenges_v1().get_all_challenge_percentiles(ROUTE)
|
||||||
|
@ -22,8 +41,8 @@ async_tests! {
|
||||||
// Spot-check 10% of the challenge IDs.
|
// Spot-check 10% of the challenge IDs.
|
||||||
for &challenge_id in percentiles.keys().step_by(10) {
|
for &challenge_id in percentiles.keys().step_by(10) {
|
||||||
RIOT_API.lol_challenges_v1().get_challenge_percentiles(ROUTE, challenge_id)
|
RIOT_API.lol_challenges_v1().get_challenge_percentiles(ROUTE, challenge_id)
|
||||||
.await.map_err(|e| format!("Failed to get challenge with id {}\n{}", challenge_id, e))?
|
.await.map_err(|e| format!("Failed to get challenge percentile with id {}\n{}", challenge_id, e))?
|
||||||
.ok_or_else(|| format!("Challenge with id {} returned 404", challenge_id))?;
|
.ok_or_else(|| format!("Challenge percentile with id {} returned 404", challenge_id))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
Loading…
Reference in a new issue