add test for LeagueV4 RU d3atomiz3d "CHERRY" QueueType

This commit is contained in:
Mingwei Samuel 2024-01-04 09:26:16 -08:00
parent 13a06b224a
commit 4391d214aa
4 changed files with 35 additions and 7 deletions

28
riven/tests/test_ru.rs Normal file
View file

@ -0,0 +1,28 @@
#![cfg_attr(feature = "nightly", feature(custom_test_frameworks))]
#![cfg_attr(feature = "nightly", test_runner(my_runner))]
mod async_tests;
mod testutils;
use testutils::*;
use colored::*;
use riven::consts::*;
const ROUTE: PlatformRoute = PlatformRoute::RU;
async_tests! {
my_runner {
summoner_leagues: async {
let sum = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "d3atomiz3d");
let sum = sum.await
.map_err(|e| format!("Error getting summoner: {}", e))?
.ok_or_else(|| "Failed to find summoner".to_owned())?;
let p = RIOT_API.league_v4().get_league_entries_for_summoner(ROUTE, &sum.id);
let s = p.await.map_err(|e| format!("Error getting league entries: {}", e))?;
let _ = s;
Ok(())
},
}
}

View file

@ -19,7 +19,7 @@ async_tests! {
// let sum = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "ma5tery"); // let sum = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "ma5tery");
// let sum = sum.await // let sum = sum.await
// .map_err(|e| format!("Error getting summoner: {}", e))? // .map_err(|e| format!("Error getting summoner: {}", e))?
// .ok_or_else(|| "Failed to get summoner".to_owned())?; // .ok_or_else(|| "Failed to find summoner".to_owned())?;
// let p = RIOT_API.champion_mastery_v4().get_champion_mastery_score(ROUTE, &sum.id); // let p = RIOT_API.champion_mastery_v4().get_champion_mastery_score(ROUTE, &sum.id);
// let s = p.await.map_err(|e| format!("Error getting champion mastery score: {}", e))?; // let s = p.await.map_err(|e| format!("Error getting champion mastery score: {}", e))?;
@ -30,7 +30,7 @@ async_tests! {
let sum = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "ma5tery"); let sum = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "ma5tery");
let sum = sum.await let sum = sum.await
.map_err(|e| format!("Error getting summoner: {}", e))? .map_err(|e| format!("Error getting summoner: {}", e))?
.ok_or_else(|| "Failed to get summoner".to_owned())?; .ok_or_else(|| "Failed to find summoner".to_owned())?;
let p = RIOT_API.champion_mastery_v4().get_champion_mastery_score_by_puuid(ROUTE, &sum.puuid); let p = RIOT_API.champion_mastery_v4().get_champion_mastery_score_by_puuid(ROUTE, &sum.puuid);
let s = p.await.map_err(|e| format!("Error getting champion mastery score: {}", e))?; let s = p.await.map_err(|e| format!("Error getting champion mastery score: {}", e))?;
@ -41,7 +41,7 @@ async_tests! {
let sum = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "ma5tery"); let sum = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "ma5tery");
let sum = sum.await let sum = sum.await
.map_err(|e| format!("Error getting summoner: {}", e))? .map_err(|e| format!("Error getting summoner: {}", e))?
.ok_or_else(|| "Failed to get summoner".to_owned())?; .ok_or_else(|| "Failed to find summoner".to_owned())?;
let p = RIOT_API.champion_mastery_v4().get_all_champion_masteries_by_puuid(ROUTE, &sum.puuid); let p = RIOT_API.champion_mastery_v4().get_all_champion_masteries_by_puuid(ROUTE, &sum.puuid);
let s = p.await.map_err(|e| format!("Error getting all champion masteries: {}", e))?; let s = p.await.map_err(|e| format!("Error getting all champion masteries: {}", e))?;
@ -58,7 +58,7 @@ async_tests! {
// let summoner_name = &featured.game_list[0].participants[0].summoner_name; // let summoner_name = &featured.game_list[0].participants[0].summoner_name;
// let summoner_p = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, summoner_name); // let summoner_p = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, summoner_name);
// let summoner = summoner_p.await.map_err(|e| e.to_string())?.ok_or_else(|| "Failed to get summoner".to_owned())?; // let summoner = summoner_p.await.map_err(|e| e.to_string())?.ok_or_else(|| "Failed to find summoner".to_owned())?;
// let livegame_p = RIOT_API.spectator_v4().get_current_game_info_by_summoner(ROUTE, &summoner.id); // let livegame_p = RIOT_API.spectator_v4().get_current_game_info_by_summoner(ROUTE, &summoner.id);
// let livegame_o = livegame_p.await.map_err(|e| e.to_string())?; // let livegame_o = livegame_p.await.map_err(|e| e.to_string())?;

View file

@ -36,7 +36,7 @@ async_tests!{
REGION, &leagueentry.summoner_id); REGION, &leagueentry.summoner_id);
summonerfuture.await summonerfuture.await
.map_err(|e| e.to_string())? .map_err(|e| e.to_string())?
.ok_or(format!("Failed to get summoner_id {}.", .ok_or(format!("Failed to find summoner_id {}.",
leagueentry.summoner_id)) leagueentry.summoner_id))
}); });
future::join_all(summoners).await future::join_all(summoners).await

View file

@ -50,7 +50,7 @@ pub async fn league_v4_match_v5_latest_combo(route: PlatformRoute) -> Result<(),
.get_by_summoner_id(route, &entry.summoner_id); .get_by_summoner_id(route, &entry.summoner_id);
let summoner_info = summoner_future let summoner_info = summoner_future
.await .await
.map_err(|e| format!("Failed to get summoner info: {}", e))?; .map_err(|e| format!("Failed to find summoner info: {}", e))?;
let match_ids_future = RIOT_API.match_v5().get_match_ids_by_puuid( let match_ids_future = RIOT_API.match_v5().get_match_ids_by_puuid(
route.to_regional(), route.to_regional(),
@ -64,7 +64,7 @@ pub async fn league_v4_match_v5_latest_combo(route: PlatformRoute) -> Result<(),
); );
let match_ids = match_ids_future let match_ids = match_ids_future
.await .await
.map_err(|e| format!("Failed to get summoner match IDs: {}", e))?; .map_err(|e| format!("Failed to find summoner match IDs: {}", e))?;
Ok(match_ids) as Result<_, String> Ok(match_ids) as Result<_, String>
}); });