Beispiel #1
0
 def test_read_bytes_to_non_framed_body_too_large(self):
     pt_stream = io.BytesIO(self.plaintext)
     test_encryptor = StreamEncryptor(source=pt_stream,
                                      key_provider=self.mock_key_provider)
     test_encryptor.bytes_read = aws_encryption_sdk.internal.defaults.MAX_NON_FRAMED_SIZE
     with six.assertRaisesRegex(self, SerializationError,
                                'Source too large for non-framed message'):
         test_encryptor._read_bytes_to_non_framed_body(5)
Beispiel #2
0
    def test_read_bytes_to_non_framed_body_too_large(self):
        pt_stream = io.BytesIO(self.plaintext)
        test_encryptor = StreamEncryptor(source=pt_stream, key_provider=self.mock_key_provider)
        test_encryptor.bytes_read = aws_encryption_sdk.internal.defaults.MAX_NON_FRAMED_SIZE
        test_encryptor._StreamEncryptor__unframed_plaintext_cache = pt_stream

        with pytest.raises(SerializationError) as excinfo:
            test_encryptor._read_bytes_to_non_framed_body(5)
        excinfo.match("Source too large for non-framed message")