Skip to content

Commit 785f33f

Browse files
committed
remove source_stream.closed from StreamDecryptor._read_bytes()
1 parent 59e9028 commit 785f33f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/aws_encryption_sdk/streaming_client.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -904,8 +904,8 @@ def _read_bytes(self, b):
904904
:param int b: Number of bytes to read
905905
:raises NotSupportedError: if content type is not supported
906906
"""
907-
if self.source_stream.closed:
908-
_LOGGER.debug("Source stream closed")
907+
if hasattr(self, "footer"):
908+
_LOGGER.debug("Source stream processing complete")
909909
return
910910

911911
buffer_length = len(self.output_buffer)

test/unit/test_streaming_client_stream_decryptor.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -502,10 +502,10 @@ def test_read_bytes_from_framed_body_bad_sequence_number(self):
502502

503503
@patch("aws_encryption_sdk.streaming_client.StreamDecryptor._read_bytes_from_non_framed_body")
504504
@patch("aws_encryption_sdk.streaming_client.StreamDecryptor._read_bytes_from_framed_body")
505-
def test_read_bytes_closed(self, mock_read_frame, mock_read_block):
505+
def test_read_bytes_completed(self, mock_read_frame, mock_read_block):
506506
ct_stream = io.BytesIO(VALUES["data_128"])
507507
test_decryptor = StreamDecryptor(key_provider=self.mock_key_provider, source=ct_stream)
508-
test_decryptor.source_stream.close()
508+
test_decryptor.footer = None
509509
test_decryptor._read_bytes(5)
510510
assert not mock_read_frame.called
511511
assert not mock_read_block.called

0 commit comments

Comments
 (0)