Merge "Refactor: use fixtures.TempDir more"

This commit is contained in:
Jenkins 2015-08-25 05:55:08 +00:00 committed by Gerrit Code Review
commit e5e0eeaa6d
2 changed files with 4 additions and 10 deletions

View File

@ -12,10 +12,10 @@
# under the License. # under the License.
import os import os
import shutil
import tempfile import tempfile
import uuid import uuid
import fixtures
import ldap.dn import ldap.dn
import mock import mock
from oslo_config import cfg from oslo_config import cfg
@ -310,8 +310,7 @@ class SslTlsTest(tests.TestCase):
def test_certdir_trust_tls(self): def test_certdir_trust_tls(self):
# We need this to actually exist, so we create a tempdir. # We need this to actually exist, so we create a tempdir.
certdir = tempfile.mkdtemp() certdir = self.useFixture(fixtures.TempDir()).path
self.addCleanup(shutil.rmtree, certdir)
self.config_fixture.config(group='ldap', self.config_fixture.config(group='ldap',
url='ldap://localhost', url='ldap://localhost',
use_tls=True, use_tls=True,
@ -339,8 +338,7 @@ class SslTlsTest(tests.TestCase):
def test_certdir_trust_ldaps(self): def test_certdir_trust_ldaps(self):
# We need this to actually exist, so we create a tempdir. # We need this to actually exist, so we create a tempdir.
certdir = tempfile.mkdtemp() certdir = self.useFixture(fixtures.TempDir()).path
self.addCleanup(shutil.rmtree, certdir)
self.config_fixture.config(group='ldap', self.config_fixture.config(group='ldap',
url='ldaps://localhost', url='ldaps://localhost',
use_tls=False, use_tls=False,

View File

@ -10,9 +10,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import shutil
import tempfile
import fixtures import fixtures
from keystone.token.providers.fernet import utils from keystone.token.providers.fernet import utils
@ -25,8 +22,7 @@ class KeyRepository(fixtures.Fixture):
def setUp(self): def setUp(self):
super(KeyRepository, self).setUp() super(KeyRepository, self).setUp()
directory = tempfile.mkdtemp() directory = self.useFixture(fixtures.TempDir()).path
self.addCleanup(shutil.rmtree, directory)
self.config_fixture.config(group='fernet_tokens', self.config_fixture.config(group='fernet_tokens',
key_repository=directory) key_repository=directory)