Browse Source

remove test utilities related to adding extensions

these functions are not used by any test, no need to keep them
around.

Change-Id: If38e8cc496cc1c3909bbb7fe4da89fa85bdc02f5
changes/79/351979/1
Steve Martinelli 6 years ago
parent
commit
6c408a0607
  1. 22
      keystone/tests/unit/core.py
  2. 3
      keystone/tests/unit/rest.py
  3. 28
      keystone/tests/unit/test_v3.py

22
keystone/tests/unit/core.py

@ -145,28 +145,6 @@ def remove_test_databases():
os.unlink(pristine)
def generate_paste_config(extension_name):
# Generate a file, based on keystone-paste.ini, that is named:
# extension_name.ini, and includes extension_name in the pipeline
with open(dirs.etc('keystone-paste.ini'), 'r') as f:
contents = f.read()
new_contents = contents.replace(' service_v3',
' %s service_v3' % (extension_name))
new_paste_file = dirs.tmp(extension_name + '.ini')
with open(new_paste_file, 'w') as f:
f.write(new_contents)
return new_paste_file
def remove_generated_paste_config(extension_name):
# Remove the generated paste config file, named extension_name.ini
paste_file_to_remove = dirs.tmp(extension_name + '.ini')
os.remove(paste_file_to_remove)
def skip_if_cache_disabled(*sections):
"""Skip a test if caching is disabled, this is a decorator.

3
keystone/tests/unit/rest.py

@ -52,9 +52,6 @@ class RestfulTestCase(unit.TestCase):
# default content type to test
content_type = 'json'
def get_extensions(self):
return None
def setUp(self, app_conf='keystone'):
super(RestfulTestCase, self).setUp()

28
keystone/tests/unit/test_v3.py

@ -258,36 +258,8 @@ class RestfulTestCase(unit.SQLDriverOverrides, rest.RestfulTestCase,
config_files.append(unit.dirs.tests_conf('backend_sql.conf'))
return config_files
def get_extensions(self):
extensions = set(['revoke'])
if hasattr(self, 'EXTENSION_NAME'):
extensions.add(self.EXTENSION_NAME)
return extensions
def generate_paste_config(self):
new_paste_file = None
try:
new_paste_file = unit.generate_paste_config(self.EXTENSION_TO_ADD)
except AttributeError:
# no need to report this error here, as most tests will not have
# EXTENSION_TO_ADD defined.
pass
finally:
return new_paste_file
def remove_generated_paste_config(self):
try:
unit.remove_generated_paste_config(self.EXTENSION_TO_ADD)
except AttributeError:
pass
def setUp(self, app_conf='keystone'):
"""Setup for v3 Restful Test Cases."""
new_paste_file = self.generate_paste_config()
self.addCleanup(self.remove_generated_paste_config)
if new_paste_file:
app_conf = 'config:%s' % (new_paste_file)
super(RestfulTestCase, self).setUp(app_conf=app_conf)
self.empty_context = {'environment': {}}

Loading…
Cancel
Save