def setUp(self): super(TestFailover, self).setUp() self._brokers = [FakeBroker(), FakeBroker()] hosts = [] for broker in self._brokers: hosts.append(messaging.TransportHost(hostname=broker.host, port=broker.port)) self._broker_url = messaging.TransportURL(self.conf, transport="amqp", hosts=hosts)
def test_parse_url(self): self.config(rpc_backend=self.rpc_backend) hosts = [] for host in self.hosts: hosts.append( messaging.TransportHost(host.get('hostname'), host.get('port'), host.get('username'), host.get('password'))) url = messaging.TransportURL(self.conf, self.transport, self.virtual_host, hosts, self.aliases) self.assertEqual(self.expected, str(url))
def test_parse_url(self): self.config(rpc_backend=None) url = messaging.TransportURL.parse(self.conf, self.url, self.aliases) hosts = [] for host in self.expect.get('hosts', []): hosts.append( messaging.TransportHost(host.get('host'), host.get('port'), host.get('username'), host.get('password'))) expected = messaging.TransportURL(self.conf, self.expect.get('transport'), self.expect.get('virtual_host'), hosts) self.assertEqual(expected, url)