def test_message_prelude_properties(): """Test that calculated properties from the payload are correct. """ # Total length: 40, Headers Length: 15, random crc prelude = MessagePrelude(40, 15, 0x00000000) assert_equal(prelude.payload_length, 9) assert_equal(prelude.headers_end, 27) assert_equal(prelude.payload_end, 36)
from nose.tools import assert_equal, raises from botocore.parsers import EventStreamXMLParser from botocore.eventstream import ( EventStreamMessage, MessagePrelude, EventStreamBuffer, ChecksumMismatch, InvalidPayloadLength, InvalidHeadersLength, DuplicateHeader, EventStreamHeaderParser, DecodeUtils, EventStream, ) from botocore.exceptions import EventStreamError EMPTY_MESSAGE = ( b'\x00\x00\x00\x10\x00\x00\x00\x00\x05\xc2H\xeb}\x98\xc8\xff', EventStreamMessage( prelude=MessagePrelude( total_length=0x10, headers_length=0, crc=0x05c248eb, ), headers={}, payload=b'', crc=0x7d98c8ff, ) ) INT32_HEADER = ( (b"\x00\x00\x00+\x00\x00\x00\x0e4\x8b\xec{\x08event-id\x04\x00\x00\xa0\x0c" b"{'foo':'bar'}\xd3\x89\x02\x85"), EventStreamMessage( prelude=MessagePrelude( total_length=0x2b, headers_length=0x0e,
from nose.tools import assert_equal, raises from botocore.parsers import EventStreamXMLParser from botocore.eventstream import (EventStreamMessage, MessagePrelude, EventStreamBuffer, ChecksumMismatch, InvalidPayloadLength, InvalidHeadersLength, DuplicateHeader, EventStreamHeaderParser, DecodeUtils, EventStream, NoInitialResponseError) from botocore.exceptions import EventStreamError EMPTY_MESSAGE = (b'\x00\x00\x00\x10\x00\x00\x00\x00\x05\xc2H\xeb}\x98\xc8\xff', EventStreamMessage( prelude=MessagePrelude( total_length=0x10, headers_length=0, crc=0x05c248eb, ), headers={}, payload=b'', crc=0x7d98c8ff, )) INT8_HEADER = ((b"\x00\x00\x00\x17\x00\x00\x00\x07)\x86\x01X\x04" b"byte\x02\xff\xc2\xf8i\xdc"), EventStreamMessage( prelude=MessagePrelude( total_length=0x17, headers_length=0x7, crc=0x29860158, ),