MCPcopy
hub / github.com/pallets/werkzeug / test_chunked_boundaries

Function test_chunked_boundaries

tests/sansio/test_multipart.py:110–131  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

108
109
110def test_chunked_boundaries() -> None:
111 boundary = b"--boundary"
112 decoder = MultipartDecoder(boundary)
113 decoder.receive_data(b"--")
114 assert isinstance(decoder.next_event(), NeedData)
115 decoder.receive_data(b"--boundary\r\n")
116 assert isinstance(decoder.next_event(), Preamble)
117 decoder.receive_data(b"Content-Disposition: form-data;")
118 assert isinstance(decoder.next_event(), NeedData)
119 decoder.receive_data(b'name="fname"\r\n\r\n')
120 assert isinstance(decoder.next_event(), Field)
121 decoder.receive_data(b"longer than the boundary")
122 assert isinstance(decoder.next_event(), Data)
123 decoder.receive_data(b"also longer, but includes a linebreak\r\n--")
124 assert isinstance(decoder.next_event(), Data)
125 assert isinstance(decoder.next_event(), NeedData)
126 decoder.receive_data(b"--boundary--\r\n")
127 event = decoder.next_event()
128 assert isinstance(event, Data)
129 assert not event.more_data
130 decoder.receive_data(None)
131 assert isinstance(decoder.next_event(), Epilogue)
132
133
134def test_empty_field() -> None:

Callers

nothing calls this directly

Calls 3

receive_dataMethod · 0.95
next_eventMethod · 0.95
MultipartDecoderClass · 0.90

Tested by

no test coverage detected