From 5cb1efadb9063ae186a3659781df4ef4e8df8ed4 Mon Sep 17 00:00:00 2001 From: Jacob Hagstedt Date: Wed, 28 Nov 2018 16:48:09 +0100 Subject: [PATCH] Fix host and port to use the ENV --- aioamqp/tests/test_connect.py | 6 ++++-- aioamqp/tests/test_protocol.py | 8 +++++--- aioamqp/tests/testcase.py | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/aioamqp/tests/test_connect.py b/aioamqp/tests/test_connect.py index f7a52ff..9ec122f 100644 --- a/aioamqp/tests/test_connect.py +++ b/aioamqp/tests/test_connect.py @@ -13,7 +13,7 @@ class AmqpConnectionTestCase(testcase.RabbitTestCase, unittest.TestCase): @testing.coroutine def test_connect(self): - _transport, proto = yield from connect(virtualhost=self.vhost, loop=self.loop) + _transport, proto = yield from connect(host=self.host, port=self.port, virtualhost=self.vhost, loop=self.loop) self.assertEqual(proto.state, OPEN) self.assertIsNotNone(proto.server_properties) yield from proto.close() @@ -25,6 +25,8 @@ def test_connect_tuning(self): channel_max = 10 heartbeat = 100 _transport, proto = yield from connect( + host=self.host, + port=self.port, virtualhost=self.vhost, loop=self.loop, channel_max=channel_max, @@ -48,7 +50,7 @@ def test_connect_tuning(self): @testing.coroutine def test_socket_nodelay(self): - transport, proto = yield from connect(virtualhost=self.vhost, loop=self.loop) + transport, proto = yield from connect(host=self.host, port=self.port, virtualhost=self.vhost, loop=self.loop) sock = transport.get_extra_info('socket') opt_val = sock.getsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY) self.assertNotEqual(opt_val, 0) diff --git a/aioamqp/tests/test_protocol.py b/aioamqp/tests/test_protocol.py index 651d875..c0e1ec4 100644 --- a/aioamqp/tests/test_protocol.py +++ b/aioamqp/tests/test_protocol.py @@ -19,7 +19,7 @@ class ProtocolTestCase(testcase.RabbitTestCase, unittest.TestCase): @testing.coroutine def test_connect(self): - _transport, protocol = yield from amqp_connect(virtualhost=self.vhost, loop=self.loop) + _transport, protocol = yield from amqp_connect(host=self.host, port=self.port, virtualhost=self.vhost, loop=self.loop) self.assertEqual(protocol.state, OPEN) yield from protocol.close() @@ -30,6 +30,8 @@ def test_connect_products_info(self): 'program_version': '0.1.1', } _transport, protocol = yield from amqp_connect( + host=self.host, + port=self.port, virtualhost=self.vhost, client_properties=client_properties, loop=self.loop, @@ -41,11 +43,11 @@ def test_connect_products_info(self): @testing.coroutine def test_connection_unexistant_vhost(self): with self.assertRaises(exceptions.AmqpClosedConnection): - yield from amqp_connect(virtualhost='/unexistant', loop=self.loop) + yield from amqp_connect(host=self.host, port=self.port, virtualhost='/unexistant', loop=self.loop) def test_connection_wrong_login_password(self): with self.assertRaises(exceptions.AmqpClosedConnection): - self.loop.run_until_complete(amqp_connect(login='wrong', password='wrong', loop=self.loop)) + self.loop.run_until_complete(amqp_connect(host=self.host, port=self.port, login='wrong', password='wrong', loop=self.loop)) @testing.coroutine def test_connection_from_url(self): diff --git a/aioamqp/tests/testcase.py b/aioamqp/tests/testcase.py index a554f60..e8f0a2d 100644 --- a/aioamqp/tests/testcase.py +++ b/aioamqp/tests/testcase.py @@ -85,7 +85,7 @@ def setUp(self): self.port = os.environ.get('AMQP_PORT', 5672) self.vhost = os.environ.get('AMQP_VHOST', self.VHOST + str(uuid.uuid4())) self.http_client = pyrabbit.api.Client( - 'localhost:15672/api/', 'guest', 'guest', timeout=20 + '{HOST}:15672/api/'.format(HOST=self.host), 'guest', 'guest', timeout=20 ) self.amqps = []