Skip to content

Commit 725bfe3

Browse files
committed
update prep_stream_data unit tests
1 parent e22d171 commit 725bfe3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/unit/test_utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import aws_encryption_sdk.internal.utils
2424
from aws_encryption_sdk.exceptions import InvalidDataKeyError, SerializationError, UnknownIdentityError
2525
from aws_encryption_sdk.internal.defaults import MAX_FRAME_SIZE, MESSAGE_ID_LENGTH
26+
from aws_encryption_sdk.internal.utils.streams import InsistentReaderBytesIO
2627
from aws_encryption_sdk.structures import DataKey, EncryptedDataKey, MasterKeyInfo, RawDataKey
2728

2829
from .test_values import VALUES
@@ -31,16 +32,19 @@
3132

3233

3334
def test_prep_stream_data_passthrough():
34-
test = aws_encryption_sdk.internal.utils.prep_stream_data(sentinel.not_a_string_or_bytes)
35+
test = aws_encryption_sdk.internal.utils.prep_stream_data(io.BytesIO(b"some data"))
3536

36-
assert test is sentinel.not_a_string_or_bytes
37+
assert isinstance(test, InsistentReaderBytesIO)
3738

3839

3940
@pytest.mark.parametrize("source", (u"some unicode data ловие", b"\x00\x01\x02"))
4041
def test_prep_stream_data_wrap(source):
4142
test = aws_encryption_sdk.internal.utils.prep_stream_data(source)
4243

44+
# Check the wrapped stream
4345
assert isinstance(test, io.BytesIO)
46+
# Check the wrapping stream
47+
assert isinstance(test, InsistentReaderBytesIO)
4448

4549

4650
class TestUtils(unittest.TestCase):

0 commit comments

Comments
 (0)