HTTPClient/region_name deprecation test updates

Creating an HTTPClient without a session is deprecated and
the ServiceCatalog's region_name parameter is also deprecated.
This follows suite with the following commits to update tests
to handle deprecation warnings:
  803eb235d5
  42bd016e1f

Change-Id: I1c5a3dc2c8448873696262ca951c58666c692a61
Closes-Bug: #1499790
This commit is contained in:
Corey Bryant
2015-09-25 15:42:49 -04:00
parent 8cf0b8fe58
commit 5dea3b22fc
10 changed files with 226 additions and 142 deletions

View File

@@ -67,10 +67,12 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
self.stub_auth(response_list=[{'json': resp_a, 'headers': headers},
{'json': resp_b, 'headers': headers}])
cs = client.Client(project_id=self.TEST_TENANT_ID,
auth_url=self.TEST_URL,
username=self.TEST_USER,
password=self.TEST_TOKEN)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
cs = client.Client(project_id=self.TEST_TENANT_ID,
auth_url=self.TEST_URL,
username=self.TEST_USER,
password=self.TEST_TOKEN)
self.assertEqual(cs.management_url,
self.TEST_RESPONSE_DICT["access"]["serviceCatalog"][3]

View File

@@ -30,9 +30,11 @@ class KeystoneClientTest(utils.TestCase):
token = client_fixtures.unscoped_token()
self.stub_auth(json=token)
c = client.Client(username='exampleuser',
password='password',
auth_url=self.TEST_URL)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
c = client.Client(username='exampleuser',
password='password',
auth_url=self.TEST_URL)
self.assertIsNotNone(c.auth_ref)
with self.deprecations.expect_deprecations_here():
self.assertFalse(c.auth_ref.scoped)
@@ -47,10 +49,12 @@ class KeystoneClientTest(utils.TestCase):
token = client_fixtures.project_scoped_token()
self.stub_auth(json=token)
c = client.Client(username='exampleuser',
password='password',
project_name='exampleproject',
auth_url=self.TEST_URL)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
c = client.Client(username='exampleuser',
password='password',
project_name='exampleproject',
auth_url=self.TEST_URL)
self.assertIsNotNone(c.auth_ref)
with self.deprecations.expect_deprecations_here():
self.assertTrue(c.auth_ref.scoped)
@@ -65,12 +69,16 @@ class KeystoneClientTest(utils.TestCase):
def test_auth_ref_load(self):
self.stub_auth(json=client_fixtures.project_scoped_token())
cl = client.Client(username='exampleuser',
password='password',
project_name='exampleproject',
auth_url=self.TEST_URL)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
cl = client.Client(username='exampleuser',
password='password',
project_name='exampleproject',
auth_url=self.TEST_URL)
cache = json.dumps(cl.auth_ref)
new_client = client.Client(auth_ref=json.loads(cache))
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
new_client = client.Client(auth_ref=json.loads(cache))
self.assertIsNotNone(new_client.auth_ref)
with self.deprecations.expect_deprecations_here():
self.assertTrue(new_client.auth_ref.scoped)
@@ -86,14 +94,18 @@ class KeystoneClientTest(utils.TestCase):
def test_auth_ref_load_with_overridden_arguments(self):
self.stub_auth(json=client_fixtures.project_scoped_token())
cl = client.Client(username='exampleuser',
password='password',
project_name='exampleproject',
auth_url=self.TEST_URL)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
cl = client.Client(username='exampleuser',
password='password',
project_name='exampleproject',
auth_url=self.TEST_URL)
cache = json.dumps(cl.auth_ref)
new_auth_url = "http://new-public:5000/v2.0"
new_client = client.Client(auth_ref=json.loads(cache),
auth_url=new_auth_url)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
new_client = client.Client(auth_ref=json.loads(cache),
auth_url=new_auth_url)
self.assertIsNotNone(new_client.auth_ref)
with self.deprecations.expect_deprecations_here():
self.assertTrue(new_client.auth_ref.scoped)
@@ -108,10 +120,12 @@ class KeystoneClientTest(utils.TestCase):
'http://admin:35357/v2.0')
def test_init_err_no_auth_url(self):
self.assertRaises(exceptions.AuthorizationFailure,
client.Client,
username='exampleuser',
password='password')
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
self.assertRaises(exceptions.AuthorizationFailure,
client.Client,
username='exampleuser',
password='password')
def test_management_url_is_updated(self):
first = fixture.V2Token()
@@ -131,10 +145,12 @@ class KeystoneClientTest(utils.TestCase):
self.stub_auth(response_list=[{'json': first}, {'json': second}])
cl = client.Client(username='exampleuser',
password='password',
project_name='exampleproject',
auth_url=self.TEST_URL)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
cl = client.Client(username='exampleuser',
password='password',
project_name='exampleproject',
auth_url=self.TEST_URL)
self.assertEqual(cl.management_url, admin_url)
cl.authenticate()
@@ -145,27 +161,33 @@ class KeystoneClientTest(utils.TestCase):
# removed ASAP, however must remain compatible.
self.stub_auth(json=client_fixtures.auth_response_body())
cl = client.Client(username='exampleuser',
password='password',
project_name='exampleproject',
auth_url=self.TEST_URL,
region_name='North')
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
cl = client.Client(username='exampleuser',
password='password',
project_name='exampleproject',
auth_url=self.TEST_URL,
region_name='North')
self.assertEqual(cl.service_catalog.url_for(service_type='image'),
'https://image.north.host/v1/')
cl = client.Client(username='exampleuser',
password='password',
project_name='exampleproject',
auth_url=self.TEST_URL,
region_name='South')
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
cl = client.Client(username='exampleuser',
password='password',
project_name='exampleproject',
auth_url=self.TEST_URL,
region_name='South')
self.assertEqual(cl.service_catalog.url_for(service_type='image'),
'https://image.south.host/v1/')
def test_client_without_auth_params(self):
self.assertRaises(exceptions.AuthorizationFailure,
client.Client,
project_name='exampleproject',
auth_url=self.TEST_URL)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
self.assertRaises(exceptions.AuthorizationFailure,
client.Client,
project_name='exampleproject',
auth_url=self.TEST_URL)
def test_client_params(self):
opts = {'auth': token_endpoint.Token('a', 'b'),

View File

@@ -55,7 +55,9 @@ class DiscoverKeystoneTests(utils.UnauthenticatedTestCase):
self.stub_url('GET', base_url=self.TEST_ROOT_URL,
json=self.TEST_RESPONSE_DICT)
cs = client.Client()
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
cs = client.Client()
versions = cs.discover(self.TEST_ROOT_URL)
self.assertIsInstance(versions, dict)
self.assertIn('message', versions)
@@ -69,7 +71,9 @@ class DiscoverKeystoneTests(utils.UnauthenticatedTestCase):
self.stub_url('GET', base_url="http://localhost:35357/",
json=self.TEST_RESPONSE_DICT)
cs = client.Client()
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
cs = client.Client()
versions = cs.discover()
self.assertIsInstance(versions, dict)
self.assertIn('message', versions)

View File

@@ -57,7 +57,9 @@ class ServiceCatalogTest(utils.TestCase):
self.assertEqual(url, "https://image.north.host/v1/")
self.AUTH_RESPONSE_BODY['access']['region_name'] = "South"
auth_ref = access.AccessInfo.factory(None, self.AUTH_RESPONSE_BODY)
# Setting region_name on the catalog is deprecated.
with self.deprecations.expect_deprecations_here():
auth_ref = access.AccessInfo.factory(None, self.AUTH_RESPONSE_BODY)
sc = auth_ref.service_catalog
url = sc.url_for(service_type='image', endpoint_type='internalURL')

View File

@@ -351,9 +351,11 @@ class TenantTests(utils.TestCase):
self.stub_url('GET', ['tenants'], base_url=new_auth_url,
json=self.TEST_TENANTS)
c = client.Client(username=self.TEST_USER,
auth_url=new_auth_url,
password=uuid.uuid4().hex)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
c = client.Client(username=self.TEST_USER,
auth_url=new_auth_url,
password=uuid.uuid4().hex)
self.assertIsNone(c.management_url)
tenant_list = c.tenants.list()

View File

@@ -152,9 +152,11 @@ class TokenTests(utils.TestCase):
token_fixture = fixture.V2Token()
self.stub_auth(base_url=new_auth_url, json=token_fixture)
c = client.Client(username=self.TEST_USER,
auth_url=new_auth_url,
password=uuid.uuid4().hex)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
c = client.Client(username=self.TEST_USER,
auth_url=new_auth_url,
password=uuid.uuid4().hex)
self.assertIsNone(c.management_url)

View File

@@ -86,10 +86,12 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
self.stub_auth(json=self.TEST_RESPONSE_DICT, subject_token=TEST_TOKEN)
cs = client.Client(user_id=self.TEST_USER,
password=self.TEST_TOKEN,
project_id=self.TEST_TENANT_ID,
auth_url=self.TEST_URL)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
cs = client.Client(user_id=self.TEST_USER,
password=self.TEST_TOKEN,
project_id=self.TEST_TENANT_ID,
auth_url=self.TEST_URL)
self.assertEqual(cs.auth_token, TEST_TOKEN)
self.assertRequestBodyIs(json=self.TEST_REQUEST_BODY)
@@ -105,11 +107,13 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
# where with assertRaises(exceptions.Unauthorized): doesn't work
# right
def client_create_wrapper():
client.Client(user_domain_name=self.TEST_DOMAIN_NAME,
username=self.TEST_USER,
password="bad_key",
project_id=self.TEST_TENANT_ID,
auth_url=self.TEST_URL)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
client.Client(user_domain_name=self.TEST_DOMAIN_NAME,
username=self.TEST_USER,
password="bad_key",
project_id=self.TEST_TENANT_ID,
auth_url=self.TEST_URL)
self.assertRaises(exceptions.Unauthorized, client_create_wrapper)
self.assertRequestBodyIs(json=self.TEST_REQUEST_BODY)
@@ -121,11 +125,13 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
self.stub_auth(json=self.TEST_RESPONSE_DICT,
base_url=self.TEST_ADMIN_URL)
cs = client.Client(user_domain_name=self.TEST_DOMAIN_NAME,
username=self.TEST_USER,
password=self.TEST_TOKEN,
project_id=self.TEST_TENANT_ID,
auth_url=self.TEST_URL)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
cs = client.Client(user_domain_name=self.TEST_DOMAIN_NAME,
username=self.TEST_USER,
password=self.TEST_TOKEN,
project_id=self.TEST_TENANT_ID,
auth_url=self.TEST_URL)
self.assertEqual(cs.management_url,
self.TEST_RESPONSE_DICT["token"]["catalog"][3]
@@ -136,11 +142,13 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
def test_authenticate_success_domain_username_password_scoped(self):
self.stub_auth(json=self.TEST_RESPONSE_DICT)
cs = client.Client(user_domain_name=self.TEST_DOMAIN_NAME,
username=self.TEST_USER,
password=self.TEST_TOKEN,
project_id=self.TEST_TENANT_ID,
auth_url=self.TEST_URL)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
cs = client.Client(user_domain_name=self.TEST_DOMAIN_NAME,
username=self.TEST_USER,
password=self.TEST_TOKEN,
project_id=self.TEST_TENANT_ID,
auth_url=self.TEST_URL)
self.assertEqual(cs.management_url,
self.TEST_RESPONSE_DICT["token"]["catalog"][3]
['endpoints'][2]["url"])
@@ -166,10 +174,12 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
self.stub_auth(json=self.TEST_RESPONSE_DICT)
cs = client.Client(user_id=self.TEST_USER,
password=self.TEST_TOKEN,
domain_id=self.TEST_DOMAIN_ID,
auth_url=self.TEST_URL)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
cs = client.Client(user_id=self.TEST_USER,
password=self.TEST_TOKEN,
domain_id=self.TEST_DOMAIN_ID,
auth_url=self.TEST_URL)
self.assertEqual(cs.auth_domain_id,
self.TEST_DOMAIN_ID)
self.assertEqual(cs.management_url,
@@ -187,10 +197,12 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
self.stub_auth(json=self.TEST_RESPONSE_DICT)
cs = client.Client(user_id=self.TEST_USER,
password=self.TEST_TOKEN,
project_id=self.TEST_TENANT_ID,
auth_url=self.TEST_URL)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
cs = client.Client(user_id=self.TEST_USER,
password=self.TEST_TOKEN,
project_id=self.TEST_TENANT_ID,
auth_url=self.TEST_URL)
self.assertEqual(cs.auth_tenant_id,
self.TEST_TENANT_ID)
self.assertEqual(cs.management_url,
@@ -206,10 +218,12 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
self.stub_auth(json=self.TEST_RESPONSE_DICT)
cs = client.Client(user_domain_name=self.TEST_DOMAIN_NAME,
username=self.TEST_USER,
password=self.TEST_TOKEN,
auth_url=self.TEST_URL)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
cs = client.Client(user_domain_name=self.TEST_DOMAIN_NAME,
username=self.TEST_USER,
password=self.TEST_TOKEN,
auth_url=self.TEST_URL)
self.assertEqual(cs.auth_token,
self.TEST_RESPONSE_HEADERS["X-Subject-Token"])
self.assertFalse('catalog' in cs.service_catalog.catalog)
@@ -224,8 +238,10 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
self.stub_url('GET', [fake_url], json=fake_resp,
base_url=self.TEST_ADMIN_IDENTITY_ENDPOINT)
cl = client.Client(auth_url=self.TEST_URL,
token=fake_token)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
cl = client.Client(auth_url=self.TEST_URL,
token=fake_token)
body = jsonutils.loads(self.requests_mock.last_request.body)
self.assertEqual(body['auth']['identity']['token']['id'], fake_token)
@@ -258,9 +274,11 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
self.stub_auth(json=self.TEST_RESPONSE_DICT)
cs = client.Client(token=self.TEST_TOKEN,
domain_id=self.TEST_DOMAIN_ID,
auth_url=self.TEST_URL)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
cs = client.Client(token=self.TEST_TOKEN,
domain_id=self.TEST_DOMAIN_ID,
auth_url=self.TEST_URL)
self.assertEqual(cs.auth_domain_id,
self.TEST_DOMAIN_ID)
self.assertEqual(cs.management_url,
@@ -280,9 +298,11 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
self.stub_auth(json=self.TEST_RESPONSE_DICT)
cs = client.Client(token=self.TEST_TOKEN,
project_id=self.TEST_TENANT_ID,
auth_url=self.TEST_URL)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
cs = client.Client(token=self.TEST_TOKEN,
project_id=self.TEST_TENANT_ID,
auth_url=self.TEST_URL)
self.assertEqual(cs.auth_tenant_id,
self.TEST_TENANT_ID)
self.assertEqual(cs.management_url,
@@ -304,8 +324,10 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
self.stub_auth(json=self.TEST_RESPONSE_DICT)
cs = client.Client(token=self.TEST_TOKEN,
auth_url=self.TEST_URL)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
cs = client.Client(token=self.TEST_TOKEN,
auth_url=self.TEST_URL)
self.assertEqual(cs.auth_token,
self.TEST_RESPONSE_HEADERS["X-Subject-Token"])
self.assertFalse('catalog' in cs.service_catalog.catalog)
@@ -320,10 +342,12 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
self.stub_url('GET', [fake_url], json=fake_resp,
base_url=self.TEST_ADMIN_IDENTITY_ENDPOINT)
cl = client.Client(username='exampleuser',
password='password',
project_name='exampleproject',
auth_url=self.TEST_URL)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
cl = client.Client(username='exampleuser',
password='password',
project_name='exampleproject',
auth_url=self.TEST_URL)
self.assertEqual(cl.auth_token, self.TEST_TOKEN)

View File

@@ -30,10 +30,12 @@ class KeystoneClientTest(utils.TestCase):
token = client_fixtures.unscoped_token()
self.stub_auth(json=token)
c = client.Client(user_domain_name=token.user_domain_name,
username=token.user_name,
password='password',
auth_url=self.TEST_URL)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
c = client.Client(user_domain_name=token.user_domain_name,
username=token.user_name,
password='password',
auth_url=self.TEST_URL)
self.assertIsNotNone(c.auth_ref)
self.assertFalse(c.auth_ref.domain_scoped)
self.assertFalse(c.auth_ref.project_scoped)
@@ -47,10 +49,12 @@ class KeystoneClientTest(utils.TestCase):
token = client_fixtures.domain_scoped_token()
self.stub_auth(json=token)
c = client.Client(user_id=token.user_id,
password='password',
domain_name=token.domain_name,
auth_url=self.TEST_URL)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
c = client.Client(user_id=token.user_id,
password='password',
domain_name=token.domain_name,
auth_url=self.TEST_URL)
self.assertIsNotNone(c.auth_ref)
self.assertTrue(c.auth_ref.domain_scoped)
self.assertFalse(c.auth_ref.project_scoped)
@@ -61,11 +65,13 @@ class KeystoneClientTest(utils.TestCase):
token = client_fixtures.project_scoped_token()
self.stub_auth(json=token),
c = client.Client(user_id=token.user_id,
password='password',
user_domain_name=token.user_domain_name,
project_name=token.project_name,
auth_url=self.TEST_URL)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
c = client.Client(user_id=token.user_id,
password='password',
user_domain_name=token.user_domain_name,
project_name=token.project_name,
auth_url=self.TEST_URL)
self.assertIsNotNone(c.auth_ref)
self.assertFalse(c.auth_ref.domain_scoped)
self.assertTrue(c.auth_ref.project_scoped)
@@ -78,12 +84,16 @@ class KeystoneClientTest(utils.TestCase):
token = client_fixtures.project_scoped_token()
self.stub_auth(json=token)
c = client.Client(user_id=token.user_id,
password='password',
project_id=token.project_id,
auth_url=self.TEST_URL)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
c = client.Client(user_id=token.user_id,
password='password',
project_id=token.project_id,
auth_url=self.TEST_URL)
cache = json.dumps(c.auth_ref)
new_client = client.Client(auth_ref=json.loads(cache))
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
new_client = client.Client(auth_ref=json.loads(cache))
self.assertIsNotNone(new_client.auth_ref)
self.assertFalse(new_client.auth_ref.domain_scoped)
self.assertTrue(new_client.auth_ref.project_scoped)
@@ -108,13 +118,17 @@ class KeystoneClientTest(utils.TestCase):
self.stub_auth(json=first)
self.stub_auth(json=second, base_url=new_auth_url)
c = client.Client(user_id=user_id,
password='password',
project_id=project_id,
auth_url=self.TEST_URL)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
c = client.Client(user_id=user_id,
password='password',
project_id=project_id,
auth_url=self.TEST_URL)
cache = json.dumps(c.auth_ref)
new_client = client.Client(auth_ref=json.loads(cache),
auth_url=new_auth_url)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
new_client = client.Client(auth_ref=json.loads(cache),
auth_url=new_auth_url)
self.assertIsNotNone(new_client.auth_ref)
self.assertFalse(new_client.auth_ref.domain_scoped)
self.assertTrue(new_client.auth_ref.project_scoped)
@@ -128,11 +142,13 @@ class KeystoneClientTest(utils.TestCase):
token = client_fixtures.trust_token()
self.stub_auth(json=token)
c = client.Client(user_domain_name=token.user_domain_name,
username=token.user_name,
password='password',
auth_url=self.TEST_URL,
trust_id=token.trust_id)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
c = client.Client(user_domain_name=token.user_domain_name,
username=token.user_name,
password='password',
auth_url=self.TEST_URL,
trust_id=token.trust_id)
self.assertIsNotNone(c.auth_ref)
self.assertFalse(c.auth_ref.domain_scoped)
self.assertFalse(c.auth_ref.project_scoped)
@@ -143,10 +159,12 @@ class KeystoneClientTest(utils.TestCase):
self.assertEqual(token.user_id, c.auth_user_id)
def test_init_err_no_auth_url(self):
self.assertRaises(exceptions.AuthorizationFailure,
client.Client,
username='exampleuser',
password='password')
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
self.assertRaises(exceptions.AuthorizationFailure,
client.Client,
username='exampleuser',
password='password')
def _management_url_is_updated(self, fixture, **kwargs):
second = copy.deepcopy(fixture)
@@ -171,10 +189,12 @@ class KeystoneClientTest(utils.TestCase):
self.stub_auth(response_list=[{'json': fixture}, {'json': second}])
cl = client.Client(username='exampleuser',
password='password',
auth_url=self.TEST_URL,
**kwargs)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
cl = client.Client(username='exampleuser',
password='password',
auth_url=self.TEST_URL,
**kwargs)
self.assertEqual(cl.management_url, first_url)
cl.authenticate()
@@ -212,10 +232,12 @@ class KeystoneClientTest(utils.TestCase):
'http://glance.south.host/glanceapi/public')
def test_client_without_auth_params(self):
self.assertRaises(exceptions.AuthorizationFailure,
client.Client,
project_name='exampleproject',
auth_url=self.TEST_URL)
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
self.assertRaises(exceptions.AuthorizationFailure,
client.Client,
project_name='exampleproject',
auth_url=self.TEST_URL)
def test_client_params(self):
opts = {'auth': token_endpoint.Token('a', 'b'),

View File

@@ -65,7 +65,9 @@ class DiscoverKeystoneTests(utils.UnauthenticatedTestCase):
status_code=300,
json=self.TEST_RESPONSE_DICT)
cs = client.Client()
# Creating a HTTPClient not using session is deprecated.
with self.deprecations.expect_deprecations_here():
cs = client.Client()
versions = cs.discover()
self.assertIsInstance(versions, dict)
self.assertIn('message', versions)

View File

@@ -76,8 +76,10 @@ class ServiceCatalogTest(utils.TestCase):
self.assertEqual(url, "http://glance.north.host/glanceapi/public")
self.AUTH_RESPONSE_BODY['token']['region_name'] = "South"
auth_ref = access.AccessInfo.factory(self.RESPONSE,
self.AUTH_RESPONSE_BODY)
# Setting region_name on the catalog is deprecated.
with self.deprecations.expect_deprecations_here():
auth_ref = access.AccessInfo.factory(self.RESPONSE,
self.AUTH_RESPONSE_BODY)
sc = auth_ref.service_catalog
url = sc.url_for(service_type='image', endpoint_type='internal')
self.assertEqual(url, "http://glance.south.host/glanceapi/internal")