forked from mirror/Riven
Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
Mingwei Samuel | c4a19bd781 |
|
@ -1,83 +0,0 @@
|
|||
#![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::*;
|
||||
// use riven::models::tournament_stub_v4::*;
|
||||
|
||||
const ROUTE: RegionalRoute = RegionalRoute::AMERICAS;
|
||||
|
||||
static MATCHES: &[&str] = &[
|
||||
"NA1_3923487226",
|
||||
"NA1_4049206905",
|
||||
"NA1_4052515784",
|
||||
"NA1_4062578191",
|
||||
"NA1_4097036960",
|
||||
// New games with `match-v5.ParticipantDto.challenges` field.
|
||||
"NA1_4209556127",
|
||||
"NA1_4212715433",
|
||||
"NA1_4265913704", // `match-v5.ParticipantDto.challenges.mejaisFullStackInTime`
|
||||
];
|
||||
|
||||
async_tests! {
|
||||
my_runner {
|
||||
// TODO FAILING since 2022/11/28 https://github.com/MingweiSamuel/Riven/actions/runs/3571320200/jobs/6003088646
|
||||
// // Champion Mastery tests.
|
||||
// tournamentstub: async {
|
||||
// let tsv4 = RIOT_API.tournament_stub_v4();
|
||||
// let provider_id = tsv4.register_provider_data(ROUTE, &ProviderRegistrationParameters {
|
||||
// region: PlatformRoute::NA1.as_region_str().to_owned(),
|
||||
// url: "https://github.com/MingweiSamuel/Riven".to_owned(),
|
||||
// })
|
||||
// .await
|
||||
// .map_err(|e| e.to_string())?;
|
||||
|
||||
// println!("provider_id: {}", provider_id);
|
||||
|
||||
// let tournament_id = tsv4.register_tournament(ROUTE, &TournamentRegistrationParameters {
|
||||
// name: Some("Riven Tourney :)".to_owned()),
|
||||
// provider_id,
|
||||
// })
|
||||
// .await
|
||||
// .map_err(|e| e.to_string())?;
|
||||
|
||||
// println!("tournament_id: {}", tournament_id);
|
||||
|
||||
// let codes_result = tsv4.create_tournament_code(ROUTE, &TournamentCodeParameters {
|
||||
// map_type: "SUMMONERS_RIFT".to_owned(),
|
||||
// metadata: Some("eW91IGZvdW5kIHRoZSBzZWNyZXQgbWVzc2FnZQ==".to_owned()),
|
||||
// pick_type: "TOURNAMENT_DRAFT".to_owned(),
|
||||
// spectator_type: "ALL".to_owned(),
|
||||
// team_size: 5,
|
||||
// allowed_summoner_ids: None,
|
||||
// }, tournament_id as i64, Some(300))
|
||||
// .await;
|
||||
|
||||
// match codes_result {
|
||||
// Ok(codes) => {
|
||||
// rassert_eq!(300, codes.len());
|
||||
// println!("codes: {}", codes.join(", "));
|
||||
// Ok(())
|
||||
// }
|
||||
// Err(mut e) => {
|
||||
// if let Some(response) = e.take_response() {
|
||||
// eprintln!("{:?}", response.text().await);
|
||||
// }
|
||||
// Err(e.to_string())
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
|
||||
match_v5_get: async {
|
||||
match_v5_get(ROUTE, MATCHES).await
|
||||
},
|
||||
match_v5_get_timeline: async {
|
||||
match_v5_get_timeline(ROUTE, MATCHES).await
|
||||
},
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@ use colored::*;
|
|||
|
||||
use riven::consts::*;
|
||||
use riven::models::summoner_v4::*;
|
||||
// use riven::models::tournament_stub_v4::*;
|
||||
|
||||
fn validate_summoners(s1: Summoner, s2: Summoner) -> Result<(), String> {
|
||||
rassert_eq!(s1.name, s2.name, "Names didn't match {}.", "");
|
||||
|
@ -24,8 +25,74 @@ fn validate_summoners(s1: Summoner, s2: Summoner) -> Result<(), String> {
|
|||
|
||||
const ROUTE: PlatformRoute = PlatformRoute::NA1;
|
||||
|
||||
static MATCHES: &[&str] = &[
|
||||
"NA1_3923487226",
|
||||
"NA1_4049206905",
|
||||
"NA1_4052515784",
|
||||
"NA1_4062578191",
|
||||
"NA1_4097036960",
|
||||
// New games with `match-v5.ParticipantDto.challenges` field.
|
||||
"NA1_4209556127",
|
||||
"NA1_4212715433",
|
||||
"NA1_4265913704", // `match-v5.ParticipantDto.challenges.mejaisFullStackInTime`
|
||||
];
|
||||
|
||||
async_tests! {
|
||||
my_runner {
|
||||
// TODO FAILING since 2022/11/28 https://github.com/MingweiSamuel/Riven/actions/runs/3571320200/jobs/6003088646
|
||||
// // Champion Mastery tests.
|
||||
// tournamentstub: async {
|
||||
// let tsv4 = RIOT_API.tournament_stub_v4();
|
||||
// let provider_id = tsv4.register_provider_data(ROUTE, &ProviderRegistrationParameters {
|
||||
// region: PlatformRoute::NA1.as_region_str().to_owned(),
|
||||
// url: "https://github.com/MingweiSamuel/Riven".to_owned(),
|
||||
// })
|
||||
// .await
|
||||
// .map_err(|e| e.to_string())?;
|
||||
|
||||
// println!("provider_id: {}", provider_id);
|
||||
|
||||
// let tournament_id = tsv4.register_tournament(ROUTE, &TournamentRegistrationParameters {
|
||||
// name: Some("Riven Tourney :)".to_owned()),
|
||||
// provider_id,
|
||||
// })
|
||||
// .await
|
||||
// .map_err(|e| e.to_string())?;
|
||||
|
||||
// println!("tournament_id: {}", tournament_id);
|
||||
|
||||
// let codes_result = tsv4.create_tournament_code(ROUTE, &TournamentCodeParameters {
|
||||
// map_type: "SUMMONERS_RIFT".to_owned(),
|
||||
// metadata: Some("eW91IGZvdW5kIHRoZSBzZWNyZXQgbWVzc2FnZQ==".to_owned()),
|
||||
// pick_type: "TOURNAMENT_DRAFT".to_owned(),
|
||||
// spectator_type: "ALL".to_owned(),
|
||||
// team_size: 5,
|
||||
// allowed_summoner_ids: None,
|
||||
// }, tournament_id as i64, Some(300))
|
||||
// .await;
|
||||
|
||||
// match codes_result {
|
||||
// Ok(codes) => {
|
||||
// rassert_eq!(300, codes.len());
|
||||
// println!("codes: {}", codes.join(", "));
|
||||
// Ok(())
|
||||
// }
|
||||
// Err(mut e) => {
|
||||
// if let Some(response) = e.take_response() {
|
||||
// eprintln!("{:?}", response.text().await);
|
||||
// }
|
||||
// Err(e.to_string())
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
|
||||
match_v5_get: async {
|
||||
match_v5_get(ROUTE.to_regional(), MATCHES).await
|
||||
},
|
||||
match_v5_get_timeline: async {
|
||||
match_v5_get_timeline(ROUTE.to_regional(), MATCHES).await
|
||||
},
|
||||
|
||||
// Summoner tests.
|
||||
summoner_double: async {
|
||||
let l1p = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "lug nuts k");
|
||||
|
@ -189,5 +256,35 @@ async_tests! {
|
|||
println!("{:?}", status);
|
||||
Ok(())
|
||||
},
|
||||
|
||||
summoner_history: async {
|
||||
let summoner = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "Bang Fangirl");
|
||||
let summoner = summoner.await.map_err(|e| e.to_string())?.ok_or_else(|| "'Bang Fangirl' not found!".to_owned())?;
|
||||
|
||||
let ids = RIOT_API
|
||||
.match_v5()
|
||||
.get_match_ids_by_puuid(
|
||||
ROUTE.to_regional(),
|
||||
&summoner.puuid,
|
||||
Some(10),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
)
|
||||
.await
|
||||
.map_err(|e| e.to_string())?;
|
||||
|
||||
for id in ids {
|
||||
let _match_data = RIOT_API
|
||||
.match_v5()
|
||||
.get_match(ROUTE.to_regional(), id.as_str())
|
||||
.await
|
||||
.map_err(|e| e.to_string())?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
},
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue