Merge "Configurable temporary directory for tests"
This commit is contained in:
commit
8c8a8a657d
@ -1,2 +0,0 @@
|
||||
[database]
|
||||
connection = sqlite:///keystone/tests/tmp/test.db
|
@ -81,7 +81,16 @@ TESTSDIR = os.path.dirname(os.path.abspath(__file__))
|
||||
ROOTDIR = os.path.normpath(os.path.join(TESTSDIR, '..', '..'))
|
||||
VENDOR = os.path.join(ROOTDIR, 'vendor')
|
||||
ETCDIR = os.path.join(ROOTDIR, 'etc')
|
||||
TMPDIR = os.path.join(TESTSDIR, 'tmp')
|
||||
|
||||
|
||||
def _calc_tmpdir():
|
||||
env_val = os.environ.get('KEYSTONE_TEST_TEMP_DIR')
|
||||
if env_val:
|
||||
return env_val
|
||||
return os.path.join(TESTSDIR, 'tmp')
|
||||
|
||||
|
||||
TMPDIR = _calc_tmpdir()
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
@ -69,9 +69,13 @@ class TestAuthPlugin(tests.TestCase):
|
||||
return [tests.dirs.etc('keystone.conf.sample'),
|
||||
tests.dirs.tests('test_overrides.conf'),
|
||||
tests.dirs.tests('backend_sql.conf'),
|
||||
tests.dirs.tests('backend_sql_disk.conf'),
|
||||
tests.dirs.tests('test_auth_plugin.conf')]
|
||||
|
||||
def config(self, config_files):
|
||||
super(TestAuthPlugin, self).config(config_files)
|
||||
db_conn = 'sqlite:///%s' % tests.dirs.tmp('test.db')
|
||||
self.config_fixture.config(group='database', connection=db_conn)
|
||||
|
||||
def test_unsupported_auth_method(self):
|
||||
method_name = uuid.uuid4().hex
|
||||
auth_data = {'methods': [method_name]}
|
||||
@ -126,7 +130,6 @@ class TestByClassNameAuthMethodRegistration(TestAuthPlugin):
|
||||
return [tests.dirs.etc('keystone.conf.sample'),
|
||||
tests.dirs.tests('test_overrides.conf'),
|
||||
tests.dirs.tests('backend_sql.conf'),
|
||||
tests.dirs.tests('backend_sql_disk.conf'),
|
||||
tests.dirs.tests('test_auth_plugin_by_class_name.conf')]
|
||||
|
||||
|
||||
|
@ -40,8 +40,7 @@ TIME_FORMAT = '%Y-%m-%dT%H:%M:%S.%fZ'
|
||||
class RestfulTestCase(rest.RestfulTestCase):
|
||||
_config_file_list = [tests.dirs.etc('keystone.conf.sample'),
|
||||
tests.dirs.tests('test_overrides.conf'),
|
||||
tests.dirs.tests('backend_sql.conf'),
|
||||
tests.dirs.tests('backend_sql_disk.conf')]
|
||||
tests.dirs.tests('backend_sql.conf')]
|
||||
|
||||
#Subclasses can override this to specify the complete list of configuration
|
||||
#files. The base version makes a copy of the original values, otherwise
|
||||
@ -90,6 +89,11 @@ class RestfulTestCase(rest.RestfulTestCase):
|
||||
|
||||
self.addCleanup(self.teardown_database)
|
||||
|
||||
def config(self, config_files):
|
||||
super(RestfulTestCase, self).config(config_files)
|
||||
db_conn = 'sqlite:///%s' % tests.dirs.tmp('test.db')
|
||||
self.config_fixture.config(group='database', connection=db_conn)
|
||||
|
||||
def load_backends(self):
|
||||
self.setup_database()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user