Skip to content

Commit

Permalink
tests: Add coverage to RST_STREAM fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MadMockers committed Mar 28, 2022
1 parent ec52beb commit a1991c7
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions test/test_closed_streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ class TestStreamsClosedByEndStream(object):
self.example_request_headers, flags=['END_STREAM']),
lambda self, ff: ff.build_headers_frame(
self.example_request_headers),
lambda self, ff: ff.build_data_frame(
data=b'some data')
]
)
@pytest.mark.parametrize("clear_streams", [True, False])
Expand Down Expand Up @@ -352,9 +354,13 @@ class TestStreamsClosedByRstStream(object):
self.example_request_headers, flags=['END_STREAM']),
]
)
@pytest.mark.parametrize(
"clear_streams_before_send", [True, False]
)
def test_resets_further_frames_after_recv_reset(self,
frame_factory,
frame):
frame,
clear_streams_before_send):
"""
A stream that is closed by receive RST_STREAM can receive further
frames: it simply sends RST_STREAM for it, and additionally
Expand All @@ -381,6 +387,9 @@ def test_resets_further_frames_after_recv_reset(self,
c.receive_data(rst_frame.serialize())
c.clear_outbound_data_buffer()

if clear_streams_before_send:
c.open_outbound_streams

f = frame(self, frame_factory)
events = c.receive_data(f.serialize())

Expand All @@ -407,8 +416,12 @@ def test_resets_further_frames_after_recv_reset(self,
assert not events
assert c.data_to_send() == b""

@pytest.mark.parametrize(
"clear_streams_before_send", [True, False]
)
def test_resets_further_data_frames_after_recv_reset(self,
frame_factory):
frame_factory,
clear_streams_before_send):
"""
A stream that is closed by receive RST_STREAM can receive further
DATA frames: it simply sends WINDOW_UPDATE for the connection flow
Expand All @@ -435,6 +448,9 @@ def test_resets_further_data_frames_after_recv_reset(self,
c.receive_data(rst_frame.serialize())
c.clear_outbound_data_buffer()

if clear_streams_before_send:
c.open_outbound_streams

f = frame_factory.build_data_frame(
data=b'some data'
)
Expand Down Expand Up @@ -493,10 +509,6 @@ def test_resets_further_frames_after_send_reset(self,

# Send initial RST_STREAM
c.reset_stream(1, h2.errors.ErrorCodes.INTERNAL_ERROR)

rst_frame = frame_factory.build_rst_stream_frame(
1, h2.errors.ErrorCodes.STREAM_CLOSED
)
c.clear_outbound_data_buffer()

f = frame(self, frame_factory)
Expand Down

0 comments on commit a1991c7

Please sign in to comment.