From 1b3b4a8a54f0cc9e91272316ff153dfa9e32936b Mon Sep 17 00:00:00 2001 From: Brant Knudson Date: Sun, 28 Feb 2016 09:42:51 -0600 Subject: [PATCH] Change tests to pass session to Client It's deprecated to construct a Client without a session. There were several tests that were constructing a Client without a session. So that we can eventually remove the deprecated behavior, change these tests to use a session. Change-Id: Ib73d7807bb62aa84485df84b89dff4ca6956a30b --- keystoneclient/tests/unit/test_base.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/keystoneclient/tests/unit/test_base.py b/keystoneclient/tests/unit/test_base.py index 38644c01f..8a6420e96 100644 --- a/keystoneclient/tests/unit/test_base.py +++ b/keystoneclient/tests/unit/test_base.py @@ -10,6 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. +from keystoneauth1.identity import v2 +from keystoneauth1 import session from oslotest import mockpatch from keystoneclient import base @@ -36,11 +38,10 @@ class BaseTest(utils.TestCase): self.assertEqual(base.getid(TmpObject), 4) def test_resource_lazy_getattr(self): - # Creating a Client not using session is deprecated. - with self.deprecations.expect_deprecations_here(): - self.client = client.Client(token=self.TEST_TOKEN, - auth_url='http://127.0.0.1:5000', - endpoint='http://127.0.0.1:5000') + auth = v2.Token(token=self.TEST_TOKEN, + auth_url='http://127.0.0.1:5000') + session_ = session.Session(auth=auth) + self.client = client.Client(session=session_) self.useFixture(mockpatch.PatchObject( self.client._adapter, 'get', side_effect=AttributeError, @@ -91,11 +92,10 @@ class ManagerTest(utils.TestCase): def setUp(self): super(ManagerTest, self).setUp() - # Creating a Client not using session is deprecated. - with self.deprecations.expect_deprecations_here(): - self.client = client.Client(token=self.TEST_TOKEN, - auth_url='http://127.0.0.1:5000', - endpoint='http://127.0.0.1:5000') + auth = v2.Token(auth_url='http://127.0.0.1:5000', + token=self.TEST_TOKEN) + session_ = session.Session(auth=auth) + self.client = client.Client(session=session_) self.mgr = base.Manager(self.client) self.mgr.resource_class = base.Resource