Refactor tempurl functional test's try-finally

This is a following patch of [1]. In [1] comment, tim suggested
implementation for same behavior with less code.
This change implemented the suggestion. See [1] for more details.

[1]: https://review.openstack.org/#/c/547306/

Change-Id: Ifd8a0534fbdf41837977028c0c6ef99f1f6ac0f0
This commit is contained in:
Kazuhiro MIYAHARA 2018-03-20 04:45:04 +00:00
parent 900bd2f0ab
commit 7e77bf34f2
1 changed files with 2 additions and 7 deletions

View File

@ -587,13 +587,8 @@ class TestContainerTempurl(Base):
def test_tempurl_keys_hidden_from_acl_readonly(self):
if not tf.cluster_info.get('tempauth'):
raise SkipTest('TEMP AUTH SPECIFIC TEST')
original_token = self.env.container.conn.storage_token
try:
self.env.container.conn.storage_token = \
self.env.conn2.storage_token
metadata = self.env.container.info()
finally:
self.env.container.conn.storage_token = original_token
metadata = self.env.container.info(cfg={
'use_token': self.env.conn2.storage_token})
self.assertNotIn(
'tempurl_key', metadata,