forked from mirror/Riven
1
0
Fork 0
Riven/tests/tests_jp.rs

33 lines
833 B
Rust
Raw Normal View History

2019-10-20 07:54:01 +00:00
#![feature(custom_test_frameworks)]
#![test_runner(my_runner)]
mod async_tests;
mod ids;
2019-10-20 07:54:01 +00:00
use colored::*;
use lazy_static::lazy_static;
use tokio::runtime::current_thread::Runtime;
use riven::RiotApi;
use riven::consts::*;
2019-10-20 07:54:01 +00:00
lazy_static! {
2019-10-22 05:43:06 +00:00
static ref RIOT_API: RiotApi = {
let api_key = std::fs::read_to_string("apikey.txt").unwrap();
2019-10-22 05:43:06 +00:00
RiotApi::with_key(api_key.trim())
2019-10-20 07:54:01 +00:00
};
}
async_tests!{
my_runner {
// Summoner tests.
summoner_get_kanjikana: async {
let p = RIOT_API.summoner_v4().get_by_summoner_name(Region::JP, "私の 頭が かたい");
let s = p.await.map_err(|e| e.to_string())?.ok_or("Failed to get myheadhard".to_owned())?;
rassert_eq!("私の頭がかたい", s.name);
2019-10-20 07:54:01 +00:00
Ok(())
},
}
}