add test for client sending over max concurrent limit (#105)
This commit is contained in:
@@ -58,6 +58,10 @@ pub fn reset<T>(id: T) -> Mock<frame::Reset>
|
||||
Mock(frame::Reset::new(id.into(), frame::Reason::NoError))
|
||||
}
|
||||
|
||||
pub fn settings() -> Mock<frame::Settings> {
|
||||
Mock(frame::Settings::default())
|
||||
}
|
||||
|
||||
// === Generic helpers of all frame types
|
||||
|
||||
pub struct Mock<T>(T);
|
||||
@@ -230,6 +234,27 @@ impl From<Mock<frame::Reset>> for SendFrame {
|
||||
}
|
||||
}
|
||||
|
||||
// ==== Settings helpers
|
||||
|
||||
impl Mock<frame::Settings> {
|
||||
pub fn max_concurrent_streams(mut self, max: u32) -> Self {
|
||||
self.0.set_max_concurrent_streams(Some(max));
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Mock<frame::Settings>> for frame::Settings {
|
||||
fn from(src: Mock<frame::Settings>) -> Self {
|
||||
src.0
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Mock<frame::Settings>> for SendFrame {
|
||||
fn from(src: Mock<frame::Settings>) -> Self {
|
||||
Frame::Settings(src.0)
|
||||
}
|
||||
}
|
||||
|
||||
// ==== "trait alias" for types that are HttpTryFrom and have Debug Errors ====
|
||||
|
||||
pub trait HttpTryInto<T> {
|
||||
|
||||
@@ -113,9 +113,11 @@ impl Handle {
|
||||
}
|
||||
|
||||
/// Perform the H2 handshake
|
||||
pub fn assert_client_handshake_with_settings(mut self, settings: frame::Settings)
|
||||
pub fn assert_client_handshake_with_settings<T>(mut self, settings: T)
|
||||
-> Box<Future<Item = (frame::Settings, Self), Error = h2::Error>>
|
||||
where T: Into<frame::Settings>,
|
||||
{
|
||||
let settings = settings.into();
|
||||
// Send a settings frame
|
||||
self.send(settings.into()).unwrap();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user