class MockedConnectionTest(unittest.TestCase): '''Create a client with mocked connection objects''' nsqd_ports = (12345, 12346) def setUp(self): with mock.patch('nsq.client.connection.Connection', MockConnection): hosts = ['localhost:%s' % port for port in self.nsqd_ports] self.client = Client(nsqd_tcp_addresses=hosts) self.connections = self.client.connections()
def setUp(self): with mock.patch('nsq.client.connection.Connection', MockConnection): hosts = ['localhost:%s' % port for port in self.nsqd_ports] self.client = Client(nsqd_tcp_addresses=hosts) self.connections = self.client.connections()