def setUp(self): super(TestClientExceptions, self).setUp() self.port = utils.get_unused_port() server = wsgi.Server() conf = utils.TestConfigOpts({'bind_host': '127.0.0.1'}) server.start(ExceptionTestApp(), conf, self.port) self.client = client.BaseClient("127.0.0.1", self.port)
def setUp(self): super(TestClientExceptions, self).setUp() self.port = utils.get_unused_port() server = wsgi.Server() self.config(bind_host='127.0.0.1') server.start(ExceptionTestApp, self.port) self.client = client.BaseClient("127.0.0.1", self.port)
def setUp(self): super(TestClient, self).setUp() self.mock = mox.Mox() self.mock.StubOutWithMock(httplib.HTTPConnection, 'request') self.mock.StubOutWithMock(httplib.HTTPConnection, 'getresponse') self.endpoint = 'example.com' self.client = client.BaseClient(self.endpoint, port=9191, auth_token=u'abc123')
def setUp(self): super(TestClientRedirects, self).setUp() self.port_one = utils.get_unused_port() self.port_two = utils.get_unused_port() server_one = wsgi.Server() server_two = wsgi.Server() server_one.start(RedirectTestApp("one"), self.port_one, "127.0.0.1") server_two.start(RedirectTestApp("two"), self.port_two, "127.0.0.1") self.client = client.BaseClient("127.0.0.1", self.port_one)
def test_connect_kwargs(self): base_client = test_client.BaseClient( host='127.0.0.1', port=80, timeout=1, use_ssl=True) actual = base_client.get_connect_kwargs() expected = {'insecure': False, 'key_file': None, 'cert_file': None, 'timeout': 1} for k in expected.keys(): self.assertEqual(expected[k], actual[k])
def setUp(self): super(TestClientRedirects, self).setUp() self.port_one = utils.get_unused_port() self.port_two = utils.get_unused_port() server_one = wsgi.Server() server_two = wsgi.Server() conf = utils.TestConfigOpts({'bind_host': '127.0.0.1'}) server_one.start(RedirectTestApp("one"), conf, self.port_one) server_two.start(RedirectTestApp("two"), conf, self.port_two) self.client = client.BaseClient("127.0.0.1", self.port_one)
def setUp(self): super(TestClientExceptions, self).setUp() self.port = utils.get_unused_port() self.image_cache_dir = os.path.join(self.test_dir, 'cache') self.config(image_cache_dir=self.image_cache_dir) self.config(image_cache_driver='sqlite') server = wsgi.Server() self.config(bind_host='127.0.0.1') self.config(workers=0) server.start(ExceptionTestApp(), self.port) self.client = client.BaseClient("127.0.0.1", self.port)
def setUp(self): super(TestClientRedirects, self).setUp() self.port_one = utils.get_unused_port() self.port_two = utils.get_unused_port() server_one = wsgi.Server() server_two = wsgi.Server() self.config(bind_host='127.0.0.1') self.config(workers=0) server_one.start(RedirectTestApp("one")(), self.port_one) server_two.start(RedirectTestApp("two")(), self.port_two) self.client = client.BaseClient("127.0.0.1", self.port_one)
def setUp(self): super(TestClientRedirects, self).setUp() self.port_one = utils.get_unused_port() self.port_two = utils.get_unused_port() self.image_cache_dir = os.path.join(self.test_dir, 'cache') self.config(image_cache_dir=self.image_cache_dir) self.config(image_cache_driver='sqlite') server_one = wsgi.Server() server_two = wsgi.Server() self.config(bind_host='127.0.0.1') self.config(workers=0) server_one.start(RedirectTestApp("one")(), self.port_one) server_two.start(RedirectTestApp("two")(), self.port_two) self.client = client.BaseClient("127.0.0.1", self.port_one)
def test_connect_kwargs(self): base_client = test_client.BaseClient(host='127.0.0.1', port=80, timeout=1, use_ssl=True) actual = base_client.get_connect_kwargs() expected = { 'insecure': False, 'key_file': None, 'ca_file': '/etc/ssl/certs/ca-certificates.crt', 'cert_file': None, 'timeout': 1 } self.assertEqual(expected['insecure'], actual['insecure']) self.assertEqual(expected['key_file'], actual['key_file']) self.assertEqual(expected['cert_file'], actual['cert_file']) self.assertEqual(expected['timeout'], actual['timeout'])
def test_connect_kwargs_default_values(self): actual = test_client.BaseClient('127.0.0.1').get_connect_kwargs() self.assertEqual({'timeout': None}, actual)
def setUp(self): super(TestClient, self).setUp() self.endpoint = 'example.com' self.client = client.BaseClient(self.endpoint, port=9191, auth_token=u'abc123')