示例#1
0
 def _get_http(self):
     dscv = CONF.identity.disable_ssl_certificate_validation
     ca_certs = CONF.identity.ca_certificates_file
     return glance_http.HTTPClient(auth_provider=self.auth_provider,
                                   filters=self.filters,
                                   insecure=dscv,
                                   ca_certs=ca_certs)
示例#2
0
 def test_get_connection_https(self):
     endpoint = 'https://fake_url.com'
     self.fake_auth.base_url = mock.MagicMock(return_value=endpoint)
     self.client = glance_http.HTTPClient(self.fake_auth, {})
     self.assertTrue(
         isinstance(self.client.get_connection(),
                    glance_http.VerifiedHTTPSConnection))
示例#3
0
 def _get_http(self):
     token, endpoint = self.keystone_auth(self.user, self.password,
                                          self.auth_url, self.service,
                                          self.tenant_name)
     dscv = self.config.identity.disable_ssl_certificate_validation
     return glance_http.HTTPClient(endpoint=endpoint, token=token,
                                   insecure=dscv)
示例#4
0
    def setUp(self):
        super(TestGlanceHTTPClient, self).setUp()
        self.endpoint = 'http://fake_url.com'
        self.fake_auth = fake_auth_provider.FakeAuthProvider()

        self.fake_auth.base_url = mock.MagicMock(return_value=self.endpoint)

        self.useFixture(
            mockpatch.PatchObject(httplib.HTTPConnection,
                                  'request',
                                  side_effect=b'fake_body'))
        self.client = glance_http.HTTPClient(self.fake_auth, {})
示例#5
0
    def setUp(self):
        super(TestGlanceHTTPClient, self).setUp()
        self.fake_http = fake_http.fake_httplib2(return_type=200)
        # NOTE(maurosr): using http here implies that we will be using httplib
        # directly. With https glance_client would use an httpS version, but
        # the real backend would still be httplib anyway and since we mock it
        # that there is no reason to care.
        self.endpoint = 'http://fake_url.com'
        self.fake_auth = fake_auth_provider.FakeAuthProvider()

        self.fake_auth.base_url = mock.MagicMock(return_value=self.endpoint)

        self.useFixture(mockpatch.PatchObject(
            httplib.HTTPConnection,
            'request',
            side_effect=self.fake_http.request(self.endpoint)[1]))
        self.client = glance_http.HTTPClient(self.fake_auth, {})
示例#6
0
 def _get_http(self):
     return glance_http.HTTPClient(auth_provider=self.auth_provider,
                                   filters=self.filters,
                                   insecure=self.dscv,
                                   ca_certs=self.ca_certs)
示例#7
0
 def test_get_connection_ipv4_https(self):
     endpoint = 'https://127.0.0.1'
     self.fake_auth.base_url = mock.MagicMock(return_value=endpoint)
     self.client = glance_http.HTTPClient(self.fake_auth, {})
     self.assertIsInstance(self.client._get_connection(),
                           glance_http.VerifiedHTTPSConnection)