Drop self.conn from base.TestCase
It's the same variable as self.cloud so just use that one in all tests. Change-Id: Ie2a526c420e7156888931832b55c5b1619d20452
This commit is contained in:
parent
416ea741c0
commit
e904cb6f4b
|
@ -436,9 +436,8 @@ class TestCase(base.TestCase):
|
|||
test_cloud = os.environ.get('OPENSTACKSDK_OS_CLOUD', cloud_name)
|
||||
self.cloud_config = self.config.get_one(
|
||||
cloud=test_cloud, validate=True, **kwargs)
|
||||
self.conn = openstack.connection.Connection(
|
||||
self.cloud = openstack.connection.Connection(
|
||||
config=self.cloud_config, strict=self.strict_cloud)
|
||||
self.cloud = self.conn
|
||||
self.addCleanup(self.cloud.task_manager.stop)
|
||||
|
||||
def get_glance_discovery_mock_dict(
|
||||
|
|
|
@ -21,7 +21,7 @@ class TestContainer(base.TestCase):
|
|||
def setUp(self):
|
||||
super(TestContainer, self).setUp()
|
||||
self.container = self.getUniqueString()
|
||||
self.endpoint = self.conn.object_store.get_endpoint() + '/'
|
||||
self.endpoint = self.cloud.object_store.get_endpoint() + '/'
|
||||
self.container_endpoint = '{endpoint}{container}'.format(
|
||||
endpoint=self.endpoint, container=self.container)
|
||||
|
||||
|
@ -118,7 +118,7 @@ class TestContainer(base.TestCase):
|
|||
json=containers)
|
||||
])
|
||||
|
||||
response = container.Container.list(self.conn.object_store)
|
||||
response = container.Container.list(self.cloud.object_store)
|
||||
|
||||
self.assertEqual(len(containers), len(list(response)))
|
||||
for index, item in enumerate(response):
|
||||
|
@ -143,7 +143,7 @@ class TestContainer(base.TestCase):
|
|||
json=self.body,
|
||||
validate=dict(headers=headers)),
|
||||
])
|
||||
sot_call(self.conn.object_store)
|
||||
sot_call(self.cloud.object_store)
|
||||
|
||||
self.assert_calls()
|
||||
|
||||
|
@ -199,7 +199,7 @@ class TestContainer(base.TestCase):
|
|||
headers=headers,
|
||||
json=data))
|
||||
])
|
||||
sot_call(self.conn.object_store)
|
||||
sot_call(self.cloud.object_store)
|
||||
|
||||
def test_create_no_headers(self):
|
||||
sot = container.Container.new(name=self.container)
|
||||
|
|
|
@ -121,7 +121,7 @@ class TestObject(base_test_object.BaseTestObject):
|
|||
# the up-conversion works properly.
|
||||
sot.if_match = self.headers['Etag']
|
||||
|
||||
rv = sot.download(self.conn.object_store)
|
||||
rv = sot.download(self.cloud.object_store)
|
||||
|
||||
self.assertEqual(self.the_data, rv)
|
||||
|
||||
|
@ -139,7 +139,7 @@ class TestObject(base_test_object.BaseTestObject):
|
|||
headers=sent_headers))
|
||||
])
|
||||
|
||||
rv = sot.create(self.conn.object_store)
|
||||
rv = sot.create(self.cloud.object_store)
|
||||
self.assertEqual(rv.etag, self.headers['Etag'])
|
||||
|
||||
self.assert_calls()
|
||||
|
|
|
@ -280,7 +280,7 @@ class Test_download_object(base_test_object.BaseTestObject):
|
|||
content=self.the_data)])
|
||||
|
||||
def test_download(self):
|
||||
data = self.conn.object_store.download_object(
|
||||
data = self.cloud.object_store.download_object(
|
||||
self.object, container=self.container)
|
||||
|
||||
self.assertEqual(data, self.the_data)
|
||||
|
@ -288,7 +288,7 @@ class Test_download_object(base_test_object.BaseTestObject):
|
|||
|
||||
def test_stream(self):
|
||||
chunk_size = 2
|
||||
for index, chunk in enumerate(self.conn.object_store.stream_object(
|
||||
for index, chunk in enumerate(self.cloud.object_store.stream_object(
|
||||
self.object, container=self.container,
|
||||
chunk_size=chunk_size)):
|
||||
chunk_len = len(chunk)
|
||||
|
|
|
@ -235,11 +235,11 @@ class TestNetworkConnection(base.TestCase):
|
|||
self.use_keystone_v3(catalog='catalog-v3-suffix.json')
|
||||
self.assertEqual(
|
||||
'openstack.network.v2._proxy',
|
||||
self.conn.network.__class__.__module__)
|
||||
self.cloud.network.__class__.__module__)
|
||||
self.assert_calls()
|
||||
self.assertEqual(
|
||||
"https://network.example.com/v2.0",
|
||||
self.conn.network.get_endpoint())
|
||||
self.cloud.network.get_endpoint())
|
||||
|
||||
|
||||
class TestNetworkConnectionSuffix(base.TestCase):
|
||||
|
@ -249,21 +249,21 @@ class TestNetworkConnectionSuffix(base.TestCase):
|
|||
def test_network_proxy(self):
|
||||
self.assertEqual(
|
||||
'openstack.network.v2._proxy',
|
||||
self.conn.network.__class__.__module__)
|
||||
self.cloud.network.__class__.__module__)
|
||||
self.assert_calls()
|
||||
self.assertEqual(
|
||||
"https://network.example.com/v2.0",
|
||||
self.conn.network.get_endpoint())
|
||||
self.cloud.network.get_endpoint())
|
||||
|
||||
|
||||
class TestAuthorize(base.TestCase):
|
||||
|
||||
def test_authorize_works(self):
|
||||
res = self.conn.authorize()
|
||||
res = self.cloud.authorize()
|
||||
self.assertEqual('KeystoneToken-1', res)
|
||||
|
||||
def test_authorize_failure(self):
|
||||
self.use_broken_keystone()
|
||||
|
||||
self.assertRaises(openstack.exceptions.HttpException,
|
||||
self.conn.authorize)
|
||||
self.cloud.authorize)
|
||||
|
|
Loading…
Reference in New Issue