Riven/tests/tests_tr.rs

41 lines
1.2 KiB
Rust
Raw Normal View History

2019-11-07 12:45:13 -08:00
#![cfg_attr(feature = "nightly", feature(custom_test_frameworks))]
#![cfg_attr(feature = "nightly", test_runner(my_runner))]
2019-10-20 00:54:01 -07:00
mod async_tests;
2019-10-30 22:52:00 -07:00
mod testutils;
use testutils::RIOT_API;
2019-10-20 00:54:01 -07:00
use colored::*;
use riven::consts::*;
2019-11-03 10:48:45 -08:00
use riven::models::summoner_v4::Summoner;
const REGION: Region = Region::TR;
2019-10-20 00:54:01 -07:00
async_tests!{
my_runner {
league_summoner_bulk_test: async {
let p = RIOT_API.league_v4().get_challenger_league(REGION, QueueType::RANKED_SOLO_5x5);
// let p = future_start(p);
let ll = p.await.map_err(|e| e.to_string())?;
2019-11-04 17:00:59 -08:00
println!("{:?} Challenger {} entries.", REGION, ll.entries.len());
let sl = ll.entries.iter().take(50)
.map(|entry| RIOT_API.summoner_v4().get_by_summoner_id(REGION, &entry.summoner_id))
.map(tokio::spawn)
.collect::<Vec<_>>();
for (i, s) in sl.into_iter().enumerate() {
let summoner: Summoner = s.await
.expect("tokio::spawn join error")
.map_err(|e| e.to_string())?;
println!("{}: {}", i + 1, summoner.name);
}
2019-10-20 00:54:01 -07:00
Ok(())
},
}
}