当前位置: 首页>>代码示例>>Python>>正文


Python DepotManager.set_default方法代码示例

本文整理汇总了Python中depot.manager.DepotManager.set_default方法的典型用法代码示例。如果您正苦于以下问题:Python DepotManager.set_default方法的具体用法?Python DepotManager.set_default怎么用?Python DepotManager.set_default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在depot.manager.DepotManager的用法示例。


在下文中一共展示了DepotManager.set_default方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_public_url_gets_redirect

# 需要导入模块: from depot.manager import DepotManager [as 别名]
# 或者: from depot.manager.DepotManager import set_default [as 别名]
    def test_public_url_gets_redirect(self):
        try:
            global S3Storage
            from depot.io.awss3 import S3Storage
        except ImportError:
            raise SkipTest('Boto not installed')

        env = os.environ
        access_key_id = env.get('AWS_ACCESS_KEY_ID')
        secret_access_key = env.get('AWS_SECRET_ACCESS_KEY')
        if access_key_id is None or secret_access_key is None:
            raise SkipTest('Amazon S3 credentials not available')

        PID = os.getpid()
        NODE = str(uuid.uuid1()).rsplit('-', 1)[-1]  # Travis runs multiple tests concurrently
        default_bucket_name = 'filedepot-%s' % (access_key_id.lower(), )
        cred = (access_key_id, secret_access_key)
        bucket_name = 'filedepot-testfs-%s-%s-%s' % (access_key_id.lower(), NODE, PID)

        DepotManager.configure('awss3', {'depot.backend': 'depot.io.awss3.S3Storage',
                                         'depot.access_key_id': access_key_id,
                                         'depot.secret_access_key': secret_access_key,
                                         'depot.bucket': bucket_name})
        DepotManager.set_default('awss3')

        app = self.make_app()
        new_file = app.post('/create_file').json

        file_path = DepotManager.url_for('%(uploaded_to)s/%(last)s' % new_file)
        uploaded_file = app.get(file_path)
        assert uploaded_file.body == FILE_CONTENT, uploaded_file
开发者ID:dirn,项目名称:depot,代码行数:33,代码来源:test_wsgi_middleware.py

示例2: test_prevent_non_existing_default

# 需要导入模块: from depot.manager import DepotManager [as 别名]
# 或者: from depot.manager.DepotManager import set_default [as 别名]
 def test_prevent_non_existing_default(self):
     DepotManager.set_default('does_not_exists')
开发者ID:adamchainz,项目名称:depot,代码行数:4,代码来源:test_depot_manager.py

示例3: bind_depot

# 需要导入模块: from depot.manager import DepotManager [as 别名]
# 或者: from depot.manager.DepotManager import set_default [as 别名]
    def bind_depot(self):
        if self.bound_depot_id not in DepotManager._depots:
            self.create_depot()

        DepotManager.set_default(self.bound_depot_id)
开发者ID:OneGov,项目名称:onegov.file,代码行数:7,代码来源:integration.py

示例4: test_changing_default_depot_works

# 需要导入模块: from depot.manager import DepotManager [as 别名]
# 或者: from depot.manager.DepotManager import set_default [as 别名]
 def test_changing_default_depot_works(self):
     DepotManager.configure('first', {'depot.storage_path': './lfs'})
     DepotManager.configure('second', {'depot.storage_path': './lfs2'})
     DepotManager.set_default('second')
     assert DepotManager.get_default() == 'second'
开发者ID:adamchainz,项目名称:depot,代码行数:7,代码来源:test_depot_manager.py


注:本文中的depot.manager.DepotManager.set_default方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。