Exemplo n.º 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), (str, bytes))
Exemplo n.º 2
0
 def test_send_builder_binary(self):
     body = b'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 = b64encode(compress(body)).decode('utf8')
     self.assertEqual(send_message_request.MessageBody, message_body)
Exemplo n.º 3
0
 def setUp(self):
     super(TestSendMessage, self).setUp()
     self.send_message_request = build_send_message_request(u'baz')
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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))
Exemplo n.º 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)
Exemplo n.º 8
0
 def test_send_builder_type(self):
     send_message_request = build_send_message_request('baz')
     self.assertIsInstance(send_message_request, SendMessageRequestEntry)