diff --git a/tests/test_framing/test_definitions/__init__.py b/tests/test_framing/test_definitions/__init__.py deleted file mode 100644 index 9f2b35b38d89264ee25685611d0a65a192e165f6..0000000000000000000000000000000000000000 --- a/tests/test_framing/test_definitions/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# coding=UTF-8 -from __future__ import absolute_import, division, print_function diff --git a/tests/test_framing/test_definitions/test_cpl.py b/tests/test_framing/test_definitions/test_cpl.py deleted file mode 100644 index 2f865778251f20fbefc6f472f16743f3a332e839..0000000000000000000000000000000000000000 --- a/tests/test_framing/test_definitions/test_cpl.py +++ /dev/null @@ -1,33 +0,0 @@ -# coding=UTF-8 -from __future__ import absolute_import, division, print_function -import unittest -import struct -import io - - -from coolamqp.framing.definitions import BasicContentPropertyList - - -class TestBasicContentPropertyList(unittest.TestCase): - def test_bcpl1(self): - bcpl = BasicContentPropertyList(content_type='text/plain', content_encoding='utf8') - - self.assertEquals(bcpl.content_type, 'text/plain') - self.assertEquals(bcpl.content_encoding, 'utf8') - - buf = io.BytesIO() - bcpl.write_to(buf) - - ser = buf.getvalue() - self.assertEquals(ser, '\xC0\x00' + chr(len('text/plain')) + b'text/plain\x04utf8') - - def test_bcpl2(self): - bcpl = BasicContentPropertyList(content_type='text/plain') - - self.assertEquals(bcpl.content_type, 'text/plain') - - buf = io.BytesIO() - bcpl.write_to(buf) - - ser = buf.getvalue() - self.assertEquals(ser, b'\x80\x00' + struct.pack('!B', len('text/plain')) + b'text/plain') diff --git a/tests/test_framing/test_definitions/test_frames.py b/tests/test_framing/test_definitions/test_frames.py deleted file mode 100644 index 295771cc557da05e6a24b2bc56aa86141be848dc..0000000000000000000000000000000000000000 --- a/tests/test_framing/test_definitions/test_frames.py +++ /dev/null @@ -1,46 +0,0 @@ -# coding=UTF-8 -from __future__ import absolute_import, division, print_function -import unittest -import io -import struct -import six -from coolamqp.framing.frames import AMQPHeaderFrame -from coolamqp.framing.definitions import BasicContentPropertyList, FRAME_HEADER, FRAME_END, ConnectionStartOk - - -class TestShitSerializesRight(unittest.TestCase): - - def test_unser_header_frame(self): - s = b'\x00\x3C\x00\x00' + \ - b'\x00\x00\x00\x00\x00\x00\x00\x0A' + \ - b'\xC0\x00\x0Atext/plain\x04utf8' - - hf = AMQPHeaderFrame.unserialize(0, memoryview(s)) - - self.assertEquals(hf.class_id, 60) - self.assertEquals(hf.weight, 0) - self.assertEquals(hf.body_size, 10) - self.assertEquals(hf.properties.content_type, b'text/plain') - self.assertEquals(hf.properties.content_encoding, b'utf8') - - def test_ser_header_frame(self): - - a_cpl = BasicContentPropertyList(content_type='text/plain') - - # content_type has len 10 - - buf = io.BytesIO() - - hdr = AMQPHeaderFrame(0, 60, 0, 0, a_cpl) - hdr.write_to(buf) - - s = b'\x00\x3C\x00\x00' + \ - b'\x00\x00\x00\x00\x00\x00\x00\x00' + \ - b'\x80\x00\x0Atext/plain' - - s = chr(FRAME_HEADER) + b'\x00\x00' + \ - struct.pack('!L', len(s)) + s + chr(FRAME_END) - - self.assertEquals(buf.getvalue(), s) - -