def setUp(self):
super(TestApi, self).setUp()
# Mock the API resources.
for resource in (buckets, health, revision_diffing, revision_documents,
revision_tags, revisions, rollback, validations,
versions):
class_names = self._get_module_class_names(resource)
for class_name in class_names:
resource_obj = self.patchobject(
resource, class_name, autospec=True)
setattr(self, utils.to_snake_case(class_name), resource_obj)
# Mock the location of the configuration files for API initialization.
curr_path = os.path.dirname(os.path.realpath(__file__))
repo_path = os.path.join(
curr_path, os.pardir, os.pardir, os.pardir, os.pardir)
temp_config_files = [
os.path.join(repo_path, 'etc', 'deckhand', 'deckhand.conf.sample'),
os.path.join(repo_path, 'etc', 'deckhand', 'deckhand-paste.ini')
]
mock_get_config_files = self.patchobject(
api, '_get_config_files', autospec=True)
mock_get_config_files.return_value = temp_config_files
评论列表
文章目录