Пример #1
0
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()
Пример #2
0
 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()