test_api_initialization.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:deckhand 作者: att-comdev 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号