コード例 #1
0
 def test_serializer_type(self):
     send_message_request = build_send_message_request('baz')
     serialized_req = serialize_send_message_request(send_message_request)
     # This seems weird, but zmq frames are a tuple so it makes sense to
     # use the same type but just ensure that all fields are strings.
     self.assertIsInstance(serialized_req, SendMessageRequestEntry)
     for fname in serialized_req._fields:
         self.assertIsInstance(getattr(serialized_req, fname), basestring)
コード例 #2
0
 def test_send_builder_binary(self):
     body = 'baz'
     send_message_request = build_send_message_request(body, binary=True)
     flags = send_message_request.MessageAttributes['flags']['StringValue']
     flags = int(flags)
     self.assertTrue(flags & BASE64_ENCODE)
     self.assertTrue(flags & ZLIB_COMPRESS)
     message_body = compress(body).encode('base64')
     self.assertEqual(send_message_request.MessageBody, message_body)
コード例 #3
0
 def setUp(self):
     super(TestSendMessage, self).setUp()
     self.send_message_request = build_send_message_request('baz')
コード例 #4
0
 def test_deserializer_equality(self):
     send_message_request = build_send_message_request('baz')
     serialized_req = serialize_send_message_request(send_message_request)
     deserialized_req = deserialize_send_message_request(serialized_req)
     self.assertEqual(deserialized_req, send_message_request)
コード例 #5
0
 def test_deserializer_type(self):
     send_message_request = build_send_message_request('baz')
     serialized_req = serialize_send_message_request(send_message_request)
     deserialized_req = deserialize_send_message_request(serialized_req)
     self.assertIsInstance(deserialized_req, SendMessageRequestEntry)
コード例 #6
0
 def test_serializer_message_attributes(self):
     send_message_request = build_send_message_request('baz')
     serialized_req = serialize_send_message_request(send_message_request)
     self.assertEqual(serialized_req.MessageAttributes,
                      dumps(send_message_request.MessageAttributes))
コード例 #7
0
 def test_send_builder_nonbinary(self):
     send_message_request = build_send_message_request('baz', binary=False)
     flags = send_message_request.MessageAttributes['flags']['StringValue']
     flags = int(flags)
     self.assertFalse(flags & BASE64_ENCODE)
     self.assertFalse(flags & ZLIB_COMPRESS)
コード例 #8
0
 def test_send_builder_type(self):
     send_message_request = build_send_message_request('baz')
     self.assertIsInstance(send_message_request, SendMessageRequestEntry)