3
3
import boto3
4
4
import pytest
5
5
from botocore import stub
6
- from botocore .response import StreamingBody
7
6
8
7
from aws_lambda_powertools .utilities .streaming ._s3_seekable_io import _S3SeekableIO
8
+ from aws_lambda_powertools .utilities .streaming .compat import PowertoolsStreamingBody
9
9
10
10
11
11
@pytest .fixture
@@ -89,7 +89,7 @@ def test_raw_stream_fetches_with_range_header_after_seek(s3_seekable_obj, s3_cli
89
89
90
90
def test_read (s3_seekable_obj , s3_client_stub ):
91
91
payload = b"hello world"
92
- streaming_body = StreamingBody (raw_stream = io .BytesIO (payload ), content_length = len (payload ))
92
+ streaming_body = PowertoolsStreamingBody (raw_stream = io .BytesIO (payload ), content_length = len (payload ))
93
93
94
94
s3_client_stub .add_response (
95
95
"get_object" ,
@@ -105,7 +105,7 @@ def test_read(s3_seekable_obj, s3_client_stub):
105
105
106
106
def test_readline (s3_seekable_obj , s3_client_stub ):
107
107
payload = b"hello world\n world hello"
108
- streaming_body = StreamingBody (raw_stream = io .BytesIO (payload ), content_length = len (payload ))
108
+ streaming_body = PowertoolsStreamingBody (raw_stream = io .BytesIO (payload ), content_length = len (payload ))
109
109
110
110
s3_client_stub .add_response (
111
111
"get_object" ,
@@ -120,7 +120,7 @@ def test_readline(s3_seekable_obj, s3_client_stub):
120
120
121
121
def test_readlines (s3_seekable_obj , s3_client_stub ):
122
122
payload = b"hello world\n world hello"
123
- streaming_body = StreamingBody (raw_stream = io .BytesIO (payload ), content_length = len (payload ))
123
+ streaming_body = PowertoolsStreamingBody (raw_stream = io .BytesIO (payload ), content_length = len (payload ))
124
124
125
125
s3_client_stub .add_response (
126
126
"get_object" ,
@@ -134,7 +134,7 @@ def test_readlines(s3_seekable_obj, s3_client_stub):
134
134
135
135
def test_closed (s3_seekable_obj , s3_client_stub ):
136
136
payload = b"test"
137
- streaming_body = StreamingBody (raw_stream = io .BytesIO (payload ), content_length = len (payload ))
137
+ streaming_body = PowertoolsStreamingBody (raw_stream = io .BytesIO (payload ), content_length = len (payload ))
138
138
139
139
s3_client_stub .add_response (
140
140
"get_object" ,
@@ -148,7 +148,7 @@ def test_closed(s3_seekable_obj, s3_client_stub):
148
148
149
149
def test_next (s3_seekable_obj , s3_client_stub ):
150
150
payload = b"test"
151
- streaming_body = StreamingBody (raw_stream = io .BytesIO (payload ), content_length = len (payload ))
151
+ streaming_body = PowertoolsStreamingBody (raw_stream = io .BytesIO (payload ), content_length = len (payload ))
152
152
153
153
s3_client_stub .add_response (
154
154
"get_object" ,
@@ -163,7 +163,7 @@ def test_next(s3_seekable_obj, s3_client_stub):
163
163
164
164
def test_context_manager (s3_seekable_obj , s3_client_stub ):
165
165
payload = b"test"
166
- streaming_body = StreamingBody (raw_stream = io .BytesIO (payload ), content_length = len (payload ))
166
+ streaming_body = PowertoolsStreamingBody (raw_stream = io .BytesIO (payload ), content_length = len (payload ))
167
167
168
168
s3_client_stub .add_response (
169
169
"get_object" ,
0 commit comments