|
11 | 11 | MetadataPushFrame, PayloadFrame, LeaseFrame, ResumeOKFrame, KeepAliveFrame,
|
12 | 12 | serialize_with_frame_size_header, RequestStreamFrame, RequestChannelFrame, ParseError,
|
13 | 13 | parse_or_ignore, Frame, RequestFireAndForgetFrame, serialize_prefix_with_frame_size_header,
|
14 |
| - parse_header_native, Header) |
| 14 | + parse_header_native, Header, is_frame_to_ignore, is_fragmentable_frame, new_frame_fragment) |
15 | 15 | from rsocket.frame_parser import FrameParser
|
16 | 16 | from tests.rsocket.helpers import data_bits, build_frame, bits
|
17 | 17 |
|
|
23 | 23 | (1, 0, 1)
|
24 | 24 | ))
|
25 | 25 | def test_parse_header_native(follows, complete, is_next):
|
26 |
| - |
27 | 26 | data = build_frame(
|
28 | 27 | bits(24, 28, 'Frame size'),
|
29 | 28 | bits(1, 0, 'Padding'),
|
@@ -51,6 +50,7 @@ def test_parse_header_native(follows, complete, is_next):
|
51 | 50 | assert flags.flags_complete_lease == complete
|
52 | 51 | assert flags.flags_next == is_next
|
53 | 52 |
|
| 53 | + |
54 | 54 | @pytest.mark.parametrize('metadata_flag, metadata, lease, frame_data', (
|
55 | 55 | (0, b'', 0, b'\x01\x02\x03'),
|
56 | 56 | (1, b'\x04\x05\x06\x07\x08', 1, b'\x01\x02\x03'),
|
@@ -801,3 +801,25 @@ def test_equality():
|
801 | 801 | async def parse_frame(data: bytes, frame_parser: FrameParser) -> Frame:
|
802 | 802 | frames = await asyncstdlib.builtins.list(frame_parser.receive_data(data))
|
803 | 803 | return frames[0]
|
| 804 | + |
| 805 | + |
| 806 | +def test_is_frame_to_ignore(): |
| 807 | + frame = RequestResponseFrame() |
| 808 | + frame.stream_id = 1 |
| 809 | + frame.flags_ignore = True |
| 810 | + |
| 811 | + assert not is_frame_to_ignore(frame) |
| 812 | + |
| 813 | + |
| 814 | +@pytest.mark.allow_error_log(regex_filter='Invalid metadata frame') |
| 815 | +def test_is_frame_to_ignore_invalid_metadata_push(): |
| 816 | + ignored_frame = MetadataPushFrame() |
| 817 | + ignored_frame.stream_id = 1 |
| 818 | + |
| 819 | + assert is_frame_to_ignore(ignored_frame) |
| 820 | + |
| 821 | + |
| 822 | +def test_is_fragmentable_frame(): |
| 823 | + frame = PayloadFrame() |
| 824 | + |
| 825 | + assert is_fragmentable_frame(frame) |
0 commit comments