Beispiel #1
0
 def test_auth_secret(self):
     '''If an auth secret is provided, it passes it to nsqlookupd'''
     with mock.patch('nsq.client.nsqlookupd.Client') as MockClient:
         client.Client(topic=self.topic,
                       lookupd_http_addresses=['foo'],
                       auth_secret='hello')
         MockClient.assert_called_with('foo', access_token='hello')
Beispiel #2
0
 def test_connect_timeout(self):
     HttpClientIntegrationTest.setUp(self)
     hosts = ['localhost:%s' % port for port in self.nsqd_ports]
     connect_timeout = 2.0
     self.client = client.Client(nsqd_tcp_addresses=hosts,
                                 connect_timeout=connect_timeout)
     self.assertEqual(self.client._connect_timeout, connect_timeout)
Beispiel #3
0
 def test_client_exception(self):
     '''Is OK when discovery fails'''
     with mock.patch('nsq.client.nsqlookupd.Client') as MockClass:
         instance = MockClass.return_value
         instance.lookup.side_effect = ClientException
         self.client = client.Client(
             lookupd_http_addresses=['http://localhost:1234'], topic='foo')
Beispiel #4
0
 def setUp(self):
     '''Return a new client'''
     HttpClientIntegrationTest.setUp(self)
     self.client = client.Client(topic=self.topic, lookupd_http_addresses=['http://localhost:14161'])
Beispiel #5
0
 def setUp(self):
     '''Return a new client'''
     HttpClientIntegrationTest.setUp(self)
     hosts = ['localhost:%s' % port for port in self.nsqd_ports]
     self.client = client.Client(nsqd_tcp_addresses=hosts)