Update faliure case tests

pull/27/head
Mingwei Samuel 2021-05-21 19:06:50 -07:00
parent 4e0d45e59d
commit 39af464170
1 changed files with 10 additions and 9 deletions

View File

@ -21,19 +21,20 @@ async_tests!{
}, },
// Failure cases. // Failure cases.
// Make sure get_raw_response(...) with invalid path fails as expected. // // Make sure get_raw_response(...) with invalid path fails as expected.
raw_response_invalid: async { // raw_response_invalid: async {
let p = RIOT_API.get_raw_response("summoner-v4.getBySummonerName", Region::JP.into(), "INVALID/PATH".to_owned(), None); // let p = RIOT_API.get_raw_response("summoner-v4.getBySummonerName", Region::JP.into(), "INVALID/PATH".to_owned(), None);
let r = p.await; // let r = p.await;
rassert!(r.is_err()); // rassert!(r.is_err());
Ok(()) // Ok(())
}, // },
// summoner_v4().get_by_summoner_name(...) normally returns an option. // summoner_v4().get_by_summoner_name(...) normally returns an option.
// If we use `get` (instead of `get_optional`) make sure it errors. // If we use `get` (instead of `get_optional`) make sure it errors.
get_nonoptional_invalid: async { get_nonoptional_invalid: async {
let path_string = format!("/lol/summoner/v4/summoners/by-name/{}", "SUMMONER THAT DOES NOT EXIST"); let path_string = format!("/lol/summoner/v4/summoners/by-name/{}", "SUMMONER THAT DOES NOT EXIST");
let p = RIOT_API.get::<riven::models::summoner_v4::Summoner>( let request = RIOT_API.request(reqwest::Method::GET, Region::JP.into(), &path_string);
"summoner-v4.getBySummonerName", Region::JP.into(), path_string, None); let p = RIOT_API.execute_val::<riven::models::summoner_v4::Summoner>(
"summoner-v4.getBySummonerName", Region::JP.into(), request);
let r = p.await; let r = p.await;
rassert!(r.is_err()); rassert!(r.is_err());
Ok(()) Ok(())