Beispiel #1
0
 def test_build_protocol_different_delegates(self):
     """Test building AMQClient getting different delegates."""
     address = IPv4Address("TCP", "127.0.0.1", 5672)
     factory = AMQFactory()
     client1 = factory.buildProtocol(address)
     client2 = factory.buildProtocol(address)
     self.assertIsNot(client2.delegate, client1.delegate)
Beispiel #2
0
 def test_build_protocol(self):
     """Test building AMQClient instances with default parameters."""
     address = IPv4Address("TCP", "127.0.0.1", 5672)
     factory = AMQFactory()
     client = factory.buildProtocol(address)
     self.assertIsInstance(client, AMQClient)
     self.assertEqual("/", client.vhost)
     self.assertEqual(DEFAULT_SPEC, client.spec.file)
     self.assertEqual(0, client.heartbeatInterval)
Beispiel #3
0
 def test_build_protocol_custom_parameters(self):
     """Test building AMQClient instances with custom parameters."""
     address = IPv4Address("TCP", "127.0.0.1", 5672)
     spec = "../specs/rabbitmq/amqp0-8.stripped.rabbitmq.xml"
     clock = Clock()
     factory = AMQFactory(spec=spec, clock=clock)
     factory.set_vhost("foo")
     factory.set_heartbeat(1)
     client = factory.buildProtocol(address)
     self.assertEqual("foo", client.vhost)
     self.assertEqual(spec, client.spec.file)
     self.assertEqual(1, client.heartbeatInterval)
     self.assertEqual(1, len(clock.getDelayedCalls()))