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


Python Config.get_all方法代码示例

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


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

示例1: test_register_configs_for_all_packs

# 需要导入模块: from st2common.persistence.pack import Config [as 别名]
# 或者: from st2common.persistence.pack.Config import get_all [as 别名]
    def test_register_configs_for_all_packs(self):
        # Verify DB is empty
        pack_dbs = Pack.get_all()
        config_dbs = Config.get_all()

        self.assertEqual(len(pack_dbs), 0)
        self.assertEqual(len(config_dbs), 0)

        registrar = ConfigsRegistrar(use_pack_cache=False)
        registrar._pack_loader.get_packs = mock.Mock()
        registrar._pack_loader.get_packs.return_value = {'dummy_pack_1': PACK_1_PATH}
        packs_base_paths = content_utils.get_packs_base_paths()
        registrar.register_from_packs(base_dirs=packs_base_paths)

        # Verify pack and schema have been registered
        pack_dbs = Pack.get_all()
        config_dbs = Config.get_all()

        self.assertEqual(len(pack_dbs), 1)
        self.assertEqual(len(config_dbs), 1)

        config_db = config_dbs[0]
        self.assertEqual(config_db.values['api_key'], '{{st2kv.user.api_key}}')
        self.assertEqual(config_db.values['api_secret'], SUPER_SECRET_PARAMETER)
        self.assertEqual(config_db.values['region'], 'us-west-1')
开发者ID:lyandut,项目名称:st2,代码行数:27,代码来源:test_configs_registrar.py

示例2: test_register_configs_for_all_packs

# 需要导入模块: from st2common.persistence.pack import Config [as 别名]
# 或者: from st2common.persistence.pack.Config import get_all [as 别名]
    def test_register_configs_for_all_packs(self):
        # Verify DB is empty
        pack_dbs = Pack.get_all()
        config_dbs = Config.get_all()

        self.assertEqual(len(pack_dbs), 0)
        self.assertEqual(len(config_dbs), 0)

        registrar = ConfigsRegistrar(use_pack_cache=False)
        registrar._pack_loader.get_packs = mock.Mock()
        registrar._pack_loader.get_packs.return_value = {"dummy_pack_1": PACK_PATH}
        packs_base_paths = content_utils.get_packs_base_paths()
        registrar.register_configs_for_all_packs(base_dirs=packs_base_paths)

        # Verify pack and schema have been registered
        pack_dbs = Pack.get_all()
        config_dbs = Config.get_all()

        self.assertEqual(len(pack_dbs), 1)
        self.assertEqual(len(config_dbs), 1)

        config_db = config_dbs[0]
        self.assertEqual(config_db.values["api_key"], "{{user.api_key}}")
        self.assertEqual(config_db.values["api_secret"], "{{user.api_secret}}")
        self.assertEqual(config_db.values["region"], "us-west-1")
开发者ID:costingalan,项目名称:st2,代码行数:27,代码来源:test_configs_registrar.py

示例3: test_register_all_configs_with_config_schema_validation_validation_failure_1

# 需要导入模块: from st2common.persistence.pack import Config [as 别名]
# 或者: from st2common.persistence.pack.Config import get_all [as 别名]
    def test_register_all_configs_with_config_schema_validation_validation_failure_1(self):
        # Verify DB is empty
        pack_dbs = Pack.get_all()
        config_dbs = Config.get_all()

        self.assertEqual(len(pack_dbs), 0)
        self.assertEqual(len(config_dbs), 0)

        registrar = ConfigsRegistrar(use_pack_cache=False, fail_on_failure=True,
                                     validate_configs=True)
        registrar._pack_loader.get_packs = mock.Mock()
        registrar._pack_loader.get_packs.return_value = {'dummy_pack_6': PACK_6_PATH}

        # Register ConfigSchema for pack
        registrar._register_pack_db = mock.Mock()
        registrar._register_pack(pack_name='dummy_pack_5', pack_dir=PACK_6_PATH)
        packs_base_paths = content_utils.get_packs_base_paths()

        if six.PY3:
            expected_msg = ('Failed validating attribute "regions" in config for pack '
                            '"dummy_pack_6" (.*?): 1000 is not of type \'array\'')
        else:
            expected_msg = ('Failed validating attribute "regions" in config for pack '
                            '"dummy_pack_6" (.*?): 1000 is not of type u\'array\'')

        self.assertRaisesRegexp(ValueError, expected_msg,
                                registrar.register_from_packs,
                                base_dirs=packs_base_paths)
开发者ID:lyandut,项目名称:st2,代码行数:30,代码来源:test_configs_registrar.py

示例4: test_register_all_configs_invalid_config_no_config_schema

# 需要导入模块: from st2common.persistence.pack import Config [as 别名]
# 或者: from st2common.persistence.pack.Config import get_all [as 别名]
    def test_register_all_configs_invalid_config_no_config_schema(self):
        # verify_ configs is on, but ConfigSchema for the pack doesn't exist so
        # validation should proceed normally

        # Verify DB is empty
        pack_dbs = Pack.get_all()
        config_dbs = Config.get_all()

        self.assertEqual(len(pack_dbs), 0)
        self.assertEqual(len(config_dbs), 0)

        registrar = ConfigsRegistrar(use_pack_cache=False, validate_configs=False)
        registrar._pack_loader.get_packs = mock.Mock()
        registrar._pack_loader.get_packs.return_value = {'dummy_pack_6': PACK_6_PATH}
        packs_base_paths = content_utils.get_packs_base_paths()
        registrar.register_from_packs(base_dirs=packs_base_paths)

        # Verify pack and schema have been registered
        pack_dbs = Pack.get_all()
        config_dbs = Config.get_all()

        self.assertEqual(len(pack_dbs), 1)
        self.assertEqual(len(config_dbs), 1)
开发者ID:lyandut,项目名称:st2,代码行数:25,代码来源:test_configs_registrar.py

示例5: setUp

# 需要导入模块: from st2common.persistence.pack import Config [as 别名]
# 或者: from st2common.persistence.pack.Config import get_all [as 别名]
    def setUp(self):
        super(UnloadActionTestCase, self).setUp()

        # Register mock pack
        # Verify DB is empty
        pack_dbs = Pack.get_all()
        config_schema_dbs = ConfigSchema.get_all()
        config_dbs = Config.get_all()

        self.assertEqual(len(pack_dbs), 0)
        self.assertEqual(len(config_schema_dbs), 0)
        self.assertEqual(len(config_dbs), 0)

        # Register the pack with all the content
        # TODO: Don't use pack cache
        cfg.CONF.set_override(name='all', override=True, group='register')
        cfg.CONF.set_override(name='pack', override=PACK_PATH_1, group='register')
        cfg.CONF.set_override(name='no_fail_on_failure', override=True, group='register')
        register_content()
开发者ID:lyandut,项目名称:st2,代码行数:21,代码来源:test_action_unload.py


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