コード例 #1
0
 def test_ascii_body_value(self):
     expectation = b'foo-bar-baz'
     self.obj = channel.ContentFrameAssembler()
     method_frame = frame.Method(1, spec.Basic.Deliver())
     self.obj.process(method_frame)
     header_frame = frame.Header(1, 11, spec.BasicProperties)
     self.obj.process(header_frame)
     body_frame = frame.Body(1, b'foo-bar-baz')
     method_frame, header_frame, body_value = self.obj.process(body_frame)
     self.assertEqual(body_value, expectation)
     self.assertIsInstance(body_value, bytes)
コード例 #2
0
 def test_binary_non_unicode_value(self):
     expectation = ('a', 0.8)
     self.obj = channel.ContentFrameAssembler()
     method_frame = frame.Method(1, spec.Basic.Deliver())
     self.obj.process(method_frame)
     marshalled_body = marshal.dumps(expectation)
     header_frame = frame.Header(1, len(marshalled_body),
                                 spec.BasicProperties)
     self.obj.process(header_frame)
     body_frame = frame.Body(1, marshalled_body)
     method_frame, header_frame, body_value = self.obj.process(body_frame)
     self.assertEqual(marshal.loads(body_value), expectation)
コード例 #3
0
 def setUp(self):
     self.obj = channel.ContentFrameAssembler()