Merge "Rename client.py to httpclient.py"

This commit is contained in:
Jenkins
2013-08-13 02:39:59 +00:00
committed by Gerrit Code Review
8 changed files with 39 additions and 39 deletions

View File

@@ -18,13 +18,13 @@
import logging
import urlparse
from keystoneclient import client
from keystoneclient import exceptions
from keystoneclient import httpclient
_logger = logging.getLogger(__name__)
class Client(client.HTTPClient):
class Client(httpclient.HTTPClient):
"""Client for the OpenStack Keystone pre-version calls API.
:param string endpoint: A user-supplied endpoint URL for the keystone
@@ -80,8 +80,8 @@ class Client(client.HTTPClient):
def _check_keystone_versions(self, url):
"""Calls Keystone URL and detects the available API versions."""
try:
httpclient = client.HTTPClient()
resp, body = httpclient.request(url, "GET",
client = httpclient.HTTPClient()
resp, body = client.request(url, "GET",
headers={'Accept':
'application/json'})
# Multiple Choices status code is returned by the root
@@ -143,10 +143,10 @@ class Client(client.HTTPClient):
def _check_keystone_extensions(self, url):
"""Calls Keystone URL and detects the available extensions."""
try:
httpclient = client.HTTPClient()
client = httpclient.HTTPClient()
if not url.endswith("/"):
url += '/'
resp, body = httpclient.request("%sextensions" % url, "GET",
resp, body = client.request("%sextensions" % url, "GET",
headers={'Accept':
'application/json'})
if resp.status_code in (200, 204): # some cases we get No Content

View File

@@ -14,8 +14,8 @@
# under the License.
import logging
from keystoneclient import client
from keystoneclient import exceptions
from keystoneclient import httpclient
from keystoneclient.v2_0 import ec2
from keystoneclient.v2_0 import endpoints
from keystoneclient.v2_0 import roles
@@ -28,7 +28,7 @@ from keystoneclient.v2_0 import users
_logger = logging.getLogger(__name__)
class Client(client.HTTPClient):
class Client(httpclient.HTTPClient):
"""Client for the OpenStack Keystone v2.0 API.
:param string username: Username for authentication. (optional)

View File

@@ -15,8 +15,8 @@
import json
import logging
from keystoneclient import client
from keystoneclient import exceptions
from keystoneclient import httpclient
from keystoneclient.v3 import credentials
from keystoneclient.v3 import domains
from keystoneclient.v3 import endpoints
@@ -31,7 +31,7 @@ from keystoneclient.v3 import users
_logger = logging.getLogger(__name__)
class Client(client.HTTPClient):
class Client(httpclient.HTTPClient):
"""Client for the OpenStack Identity API v3.
:param string user_id: User ID for authentication. (optional)

View File

@@ -3,8 +3,8 @@ import mock
import requests
from keystoneclient import client
from keystoneclient import exceptions
from keystoneclient import httpclient
from tests import utils
@@ -16,7 +16,7 @@ MOCK_REQUEST = mock.Mock(return_value=(FAKE_RESPONSE))
def get_client():
cl = client.HTTPClient(username="username", password="password",
cl = httpclient.HTTPClient(username="username", password="password",
tenant_id="tenant", auth_url="auth_test")
return cl
@@ -108,7 +108,7 @@ class ClientTest(utils.TestCase):
def test_forwarded_for(self):
ORIGINAL_IP = "10.100.100.1"
cl = client.HTTPClient(username="username", password="password",
cl = httpclient.HTTPClient(username="username", password="password",
tenant_id="tenant", auth_url="auth_test",
original_ip=ORIGINAL_IP)

View File

@@ -3,7 +3,7 @@ import mock
import requests
from keystoneclient import client
from keystoneclient import httpclient
from tests import utils
@@ -15,7 +15,7 @@ MOCK_REQUEST = mock.Mock(return_value=(FAKE_RESPONSE))
def get_client():
cl = client.HTTPClient(username="username", password="password",
cl = httpclient.HTTPClient(username="username", password="password",
tenant_id="tenant", auth_url="auth_test",
cacert="ca.pem", key="key.pem", cert="cert.pem")
return cl
@@ -71,7 +71,7 @@ class ClientTest(utils.TestCase):
def test_post_auth(self):
with mock.patch.object(requests, "request", MOCK_REQUEST):
cl = client.HTTPClient(
cl = httpclient.HTTPClient(
username="username", password="password", tenant_id="tenant",
auth_url="auth_test", cacert="ca.pem", key="key.pem",
cert="cert.pem")

View File

@@ -1,7 +1,7 @@
import datetime
from keystoneclient import access
from keystoneclient import client
from keystoneclient import httpclient
from keystoneclient.openstack.common import timeutils
from tests import utils
@@ -58,7 +58,7 @@ class KeyringTest(utils.TestCase):
Ensure that we get no value back if we don't have use_keyring
set in the client.
"""
cl = client.HTTPClient(username=USERNAME, password=PASSWORD,
cl = httpclient.HTTPClient(username=USERNAME, password=PASSWORD,
tenant_id=TENANT_ID, auth_url=AUTH_URL)
(keyring_key, auth_ref) = cl.get_auth_ref_from_keyring(
@@ -72,7 +72,7 @@ class KeyringTest(utils.TestCase):
self.assertIsNone(auth_ref)
def test_build_keyring_key(self):
cl = client.HTTPClient(username=USERNAME, password=PASSWORD,
cl = httpclient.HTTPClient(username=USERNAME, password=PASSWORD,
tenant_id=TENANT_ID, auth_url=AUTH_URL)
keyring_key = cl._build_keyring_key(auth_url=AUTH_URL,
@@ -86,7 +86,7 @@ class KeyringTest(utils.TestCase):
(AUTH_URL, TENANT_ID, TENANT, TOKEN, USERNAME))
def test_set_and_get_keyring_expired(self):
cl = client.HTTPClient(username=USERNAME, password=PASSWORD,
cl = httpclient.HTTPClient(username=USERNAME, password=PASSWORD,
tenant_id=TENANT_ID, auth_url=AUTH_URL,
use_keyring=True)
keyring_key = cl._build_keyring_key(auth_url=AUTH_URL,
@@ -108,7 +108,7 @@ class KeyringTest(utils.TestCase):
self.assertIsNone(auth_ref)
def test_set_and_get_keyring(self):
cl = client.HTTPClient(username=USERNAME, password=PASSWORD,
cl = httpclient.HTTPClient(username=USERNAME, password=PASSWORD,
tenant_id=TENANT_ID, auth_url=AUTH_URL,
use_keyring=True)
keyring_key = cl._build_keyring_key(auth_url=AUTH_URL,

View File

@@ -5,7 +5,7 @@ import sys
from testtools import matchers
from keystoneclient import client
from keystoneclient import httpclient
from tests import utils
from tests.v2_0 import fakes
@@ -28,11 +28,11 @@ class ShellTests(utils.TestCase):
self.fake_client = fakes.FakeHTTPClient()
self.stubs.Set(
client.HTTPClient, "_cs_request",
httpclient.HTTPClient, "_cs_request",
lambda ign_self, *args, **kwargs:
self.fake_client._cs_request(*args, **kwargs))
self.stubs.Set(
client.HTTPClient, "authenticate",
httpclient.HTTPClient, "authenticate",
lambda cl_obj:
self.fake_client.authenticate(cl_obj))
self.old_environment = os.environ.copy()