2019-10-20 07:54:01 +00:00
|
|
|
#![feature(custom_test_frameworks)]
|
|
|
|
#![test_runner(my_runner)]
|
|
|
|
|
|
|
|
mod async_tests;
|
2019-10-31 05:52:00 +00:00
|
|
|
mod testutils;
|
2019-11-03 03:55:07 +00:00
|
|
|
use testutils::{ RIOT_API, future_start };
|
2019-10-20 07:54:01 +00:00
|
|
|
|
|
|
|
use colored::*;
|
|
|
|
|
2019-10-30 20:24:07 +00:00
|
|
|
use riven::consts::*;
|
2019-11-03 18:48:45 +00:00
|
|
|
use riven::models::summoner_v4::Summoner;
|
2019-11-03 03:55:07 +00:00
|
|
|
|
|
|
|
const REGION: Region = Region::TR;
|
2019-10-30 20:24:07 +00:00
|
|
|
|
|
|
|
|
2019-10-20 07:54:01 +00:00
|
|
|
async_tests!{
|
|
|
|
my_runner {
|
2019-10-30 20:24:07 +00:00
|
|
|
league_summoner_bulk_test: async {
|
2019-11-03 03:55:07 +00:00
|
|
|
let p = RIOT_API.league_v4().get_challenger_league(REGION, QueueType::RANKED_SOLO_5x5);
|
|
|
|
// let p = future_start(p);
|
2019-10-30 20:24:07 +00:00
|
|
|
let ll = p.await.map_err(|e| e.to_string())?.ok_or("Failed to get challenger league".to_owned())?;
|
2019-11-03 03:55:07 +00:00
|
|
|
|
|
|
|
println!("{} Challenger {} entries.", REGION.key, ll.entries.len());
|
|
|
|
|
|
|
|
let sl = ll.entries[..50].iter()
|
|
|
|
.map(|entry| RIOT_API.summoner_v4().get_by_summoner_id(REGION, &entry.summoner_id))
|
|
|
|
.map(future_start)
|
|
|
|
.collect::<Vec<_>>();
|
|
|
|
|
|
|
|
for (i, s) in sl.into_iter().enumerate() {
|
|
|
|
let summoner_opt: Option<Summoner> = s.await.map_err(|e| e.to_string())?;
|
|
|
|
let summoner = summoner_opt.ok_or("Failed to get summoner.".to_owned())?;
|
|
|
|
println!("{}: {}", i + 1, summoner.name);
|
|
|
|
}
|
|
|
|
|
2019-10-20 07:54:01 +00:00
|
|
|
Ok(())
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|