mirror of
https://github.com/MingweiSamuel/Riven.git
synced 2024-12-27 03:16:33 +00:00
Add tests for headers and response body
This commit is contained in:
parent
d5494ba442
commit
169fa50f63
1 changed files with 25 additions and 0 deletions
|
@ -49,6 +49,31 @@ async_tests!{
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
},
|
||||||
|
inspecting_response_and_headers_on_error: async {
|
||||||
|
let sum = RIOT_API.summoner_v4().get_by_puuid(Region::EUW, "clearly not a puuid").await;
|
||||||
|
|
||||||
|
match sum {
|
||||||
|
Ok(_summoner) => rassert!(false, "Should not have succeeded"),
|
||||||
|
Err(error) => {
|
||||||
|
match error.headers() {
|
||||||
|
Some(headers) => {
|
||||||
|
rassert!(headers.len() > 0, "Invalid headers received: {:?}", error);
|
||||||
|
rassert!(headers.contains_key("x-app-rate-limit"), "Invalid headers received: {:?}", error);
|
||||||
|
rassert!(headers.contains_key("x-method-rate-limit"), "Invalid headers received: {:?}", error);
|
||||||
|
},
|
||||||
|
None => rassert!(false, "Headers shouldn't be empty"),
|
||||||
|
}
|
||||||
|
match error.response_body() {
|
||||||
|
Some(body) => {
|
||||||
|
rassert!(body.len() > 0, "Invalid body received: {:?}", error);
|
||||||
|
},
|
||||||
|
None => rassert!(false, "The response body shouldn't be empty"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
},
|
||||||
// // TFT tests.
|
// // TFT tests.
|
||||||
// tftleaguev1_getchallengerleague: async {
|
// tftleaguev1_getchallengerleague: async {
|
||||||
// let p = RIOT_API.tft_league_v1().get_challenger_league(Region::EUW);
|
// let p = RIOT_API.tft_league_v1().get_challenger_league(Region::EUW);
|
||||||
|
|
Loading…
Reference in a new issue