• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python fixturesloader.FixturesLoader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中st2tests.fixturesloader.FixturesLoader的典型用法代码示例。如果您正苦于以下问题:Python FixturesLoader类的具体用法?Python FixturesLoader怎么用?Python FixturesLoader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: setUpClass

    def setUpClass(cls):
        EventletTestCase.setUpClass()
        DbTestCase.setUpClass()

        loader = FixturesLoader()
        loader.save_fixtures_to_db(fixtures_pack=PACK,
                                   fixtures_dict=TEST_FIXTURES)
开发者ID:AlexeyDeyneko,项目名称:st2,代码行数:7,代码来源:test_concurrency.py


示例2: setUpClass

    def setUpClass(cls):
        super(TestTimersHolder, cls).setUpClass()

        loader = FixturesLoader()
        TestTimersHolder.MODELS = loader.load_fixtures(
            fixtures_pack=PACK, fixtures_dict=FIXTURES)['triggers']
        loader.save_fixtures_to_db(fixtures_pack=PACK, fixtures_dict=FIXTURES)
开发者ID:lyandut,项目名称:st2,代码行数:7,代码来源:test_timers.py


示例3: test_create_or_update_trigger_db_simple_triggers

    def test_create_or_update_trigger_db_simple_triggers(self):
        test_fixtures = {
            'triggertypes': ['triggertype1.yaml']
        }
        loader = FixturesLoader()
        fixtures = loader.save_fixtures_to_db(fixtures_pack='generic', fixtures_dict=test_fixtures)
        triggertypes = fixtures['triggertypes']
        trigger_type_ref = ResourceReference.to_string_reference(
            name=triggertypes['triggertype1.yaml']['name'],
            pack=triggertypes['triggertype1.yaml']['pack'])

        trigger = {
            'name': triggertypes['triggertype1.yaml']['name'],
            'pack': triggertypes['triggertype1.yaml']['pack'],
            'type': trigger_type_ref
        }
        trigger_service.create_or_update_trigger_db(trigger)
        triggers = Trigger.get_all()
        self.assertTrue(len(triggers) == 1, 'Only one trigger should be created.')
        self.assertTrue(triggers[0]['name'] == triggertypes['triggertype1.yaml']['name'])

        # Try adding duplicate
        trigger_service.create_or_update_trigger_db(trigger)
        triggers = Trigger.get_all()
        self.assertTrue(len(triggers) == 1, 'Only one trigger should be present.')
        self.assertTrue(triggers[0]['name'] == triggertypes['triggertype1.yaml']['name'])
开发者ID:lyandut,项目名称:st2,代码行数:26,代码来源:test_trigger_services.py


示例4: test_exception_thrown_when_rule_creation_no_trigger_yes_triggertype

    def test_exception_thrown_when_rule_creation_no_trigger_yes_triggertype(self):
        test_fixtures = {
            'triggertypes': ['triggertype1.yaml']
        }
        loader = FixturesLoader()
        fixtures = loader.save_fixtures_to_db(fixtures_pack='generic', fixtures_dict=test_fixtures)
        triggertypes = fixtures['triggertypes']
        trigger_type_ref = ResourceReference.to_string_reference(
            name=triggertypes['triggertype1.yaml']['name'],
            pack=triggertypes['triggertype1.yaml']['pack'])

        rule = {
            'name': 'fancyrule',
            'trigger': {
                'type': trigger_type_ref
            },
            'criteria': {

            },
            'action': {
                'ref': 'core.local',
                'parameters': {
                    'cmd': 'date'
                }
            }
        }
        rule_api = RuleAPI(**rule)
        self.assertRaises(TriggerDoesNotExistException,
                          trigger_service.create_trigger_db_from_rule, rule_api)
开发者ID:lyandut,项目名称:st2,代码行数:29,代码来源:test_trigger_services.py


示例5: setUpClass

 def setUpClass(cls):
     super(BackstopRuleMatcherTestCase, cls).setUpClass()
     fixturesloader = FixturesLoader()
     # Create TriggerTypes before creation of Rule to avoid failure. Rule requires the
     # Trigger and therefore TriggerType to be created prior to rule creation.
     cls.models = fixturesloader.save_fixtures_to_db(
         fixtures_pack=PACK, fixtures_dict=FIXTURES_TRIGGERS)
     cls.models.update(fixturesloader.save_fixtures_to_db(
         fixtures_pack=PACK, fixtures_dict=FIXTURES_RULES))
开发者ID:StackStorm,项目名称:st2,代码行数:9,代码来源:test_rule_matcher.py


示例6: setUpClass

    def setUpClass(cls):
        EventletTestCase.setUpClass()
        DbTestCase.setUpClass()

        # Register common policy types
        register_policy_types(st2common)

        loader = FixturesLoader()
        loader.save_fixtures_to_db(fixtures_pack=PACK, fixtures_dict=TEST_FIXTURES)
开发者ID:rlugojr,项目名称:st2,代码行数:9,代码来源:test_concurrency.py


示例7: setUp

    def setUp(self):
        super(SchedulerPoliciesTest, self).setUp()

        # Register common policy types
        register_policy_types(st2common)

        loader = FixturesLoader()
        models = loader.save_fixtures_to_db(fixtures_pack=PACK,
                                            fixtures_dict=TEST_FIXTURES_2)

        # Policy with "post_run" application
        self.policy_db = models['policies']['policy_1.yaml']
开发者ID:lyandut,项目名称:st2,代码行数:12,代码来源:test_base.py


示例8: setUpClass

    def setUpClass(cls):
        ExecutionDbTestCase.setUpClass()

        # Register runners
        runners_registrar.register_runners()

        # Register common policy types
        register_policy_types(st2common)

        loader = FixturesLoader()
        loader.save_fixtures_to_db(fixtures_pack=PACK,
                                   fixtures_dict=TEST_FIXTURES)
开发者ID:StackStorm,项目名称:st2,代码行数:12,代码来源:test_scheduler.py


示例9: setUp

    def setUp(self):
        super(NotifierPoliciesTestCase, self).setUp()

        # Register runners
        runners_registrar.register_runners()

        # Register common policy types
        register_policy_types(st2common)

        loader = FixturesLoader()
        models = loader.save_fixtures_to_db(fixtures_pack=PACK,
                                            fixtures_dict=TEST_FIXTURES_1)

        # Policy with "post_run" application
        self.policy_db = models['policies']['policy_4.yaml']
开发者ID:StackStorm,项目名称:st2,代码行数:15,代码来源:test_base.py


示例10: setUpClass

    def setUpClass(cls):
        EventletTestCase.setUpClass()
        DbTestCase.setUpClass()

        # Override the coordinator to use the noop driver otherwise the tests will be blocked.
        tests_config.parse_args(coordinator_noop=True)
        coordination.COORDINATOR = None

        # Register runners
        runners_registrar.register_runners()

        # Register common policy types
        register_policy_types(st2common)

        loader = FixturesLoader()
        loader.save_fixtures_to_db(fixtures_pack=PACK,
                                   fixtures_dict=TEST_FIXTURES)
开发者ID:StackStorm,项目名称:st2,代码行数:17,代码来源:test_concurrency.py


示例11: test_create_trigger_db_from_rule_duplicate

    def test_create_trigger_db_from_rule_duplicate(self):
        test_fixtures = {
            'rules': ['cron_timer_rule_1.yaml', 'cron_timer_rule_2.yaml']
        }
        loader = FixturesLoader()
        fixtures = loader.load_fixtures(fixtures_pack='generic', fixtures_dict=test_fixtures)
        rules = fixtures['rules']

        trigger_db_ret_1 = trigger_service.create_trigger_db_from_rule(
            RuleAPI(**rules['cron_timer_rule_1.yaml']))
        self.assertTrue(trigger_db_ret_1 is not None)
        trigger_db_ret_2 = trigger_service.create_trigger_db_from_rule(
            RuleAPI(**rules['cron_timer_rule_2.yaml']))
        self.assertTrue(trigger_db_ret_2 is not None)
        self.assertEqual(trigger_db_ret_1, trigger_db_ret_2, 'Should reuse same trigger.')
        trigger_db = Trigger.get_by_id(trigger_db_ret_1.id)
        self.assertDictEqual(trigger_db.parameters,
                             rules['cron_timer_rule_1.yaml']['trigger']['parameters'])
开发者ID:lyandut,项目名称:st2,代码行数:18,代码来源:test_trigger_services.py


示例12: setUp

    def setUp(self):
        super(RetryPolicyTestCase, self).setUp()

        # Register common policy types
        register_policy_types(st2actions)

        loader = FixturesLoader()
        models = loader.save_fixtures_to_db(fixtures_pack=PACK,
                                            fixtures_dict=TEST_FIXTURES)

        # Instantiate policy applicator we will use in the tests
        policy_db = models['policies']['policy_4.yaml']
        retry_on = policy_db.parameters['retry_on']
        max_retry_count = policy_db.parameters['max_retry_count']
        self.policy = ExecutionRetryPolicyApplicator(policy_ref='test_policy',
                                                     policy_type='action.retry',
                                                     retry_on=retry_on,
                                                     max_retry_count=max_retry_count,
                                                     delay=0)
开发者ID:Plexxi,项目名称:st2,代码行数:19,代码来源:test_retry_policy.py


示例13: FixturesLoader

        WF_INVALID_SYNTAX_FILE,
        WF_INVALID_YAQL_FILE
    ],
    'actions': [
        'a1.yaml',
        'a2.yaml',
        'action1.yaml'
    ],
    'runners': [
        'testrunner1.yaml',
        'testrunner2.yaml'
    ]
}

PACK = 'generic'
LOADER = FixturesLoader()
FIXTURES = LOADER.load_fixtures(fixtures_pack=PACK, fixtures_dict=TEST_FIXTURES)
WB_PRE_XFORM_PATH = LOADER.get_fixture_file_path_abs(PACK, 'workflows', WB_PRE_XFORM_FILE)
WB_INVALID_SYNTAX_PATH = LOADER.get_fixture_file_path_abs(PACK, 'workflows', WB_INVALID_SYNTAX_FILE)
WB_INVALID_YAQL_PATH = LOADER.get_fixture_file_path_abs(PACK, 'workflows', WB_INVALID_YAQL_FILE)
WF_PRE_XFORM_PATH = LOADER.get_fixture_file_path_abs(PACK, 'workflows', WF_PRE_XFORM_FILE)
WF_NO_REQ_PARAM_PATH = LOADER.get_fixture_file_path_abs(PACK, 'workflows', WF_NO_REQ_PARAM_FILE)
WF_UNEXP_PARAM_PATH = LOADER.get_fixture_file_path_abs(PACK, 'workflows', WF_UNEXP_PARAM_FILE)
WF_INVALID_SYNTAX_PATH = LOADER.get_fixture_file_path_abs(PACK, 'workflows', WF_INVALID_SYNTAX_FILE)
WF_INVALID_YAQL_PATH = LOADER.get_fixture_file_path_abs(PACK, 'workflows', WF_INVALID_YAQL_FILE)


class MistralValidationControllerTest(FunctionalTest):

    @classmethod
    def setUpClass(cls):
开发者ID:AlexeyDeyneko,项目名称:st2,代码行数:31,代码来源:test_validator_mistral.py


示例14: FixturesLoader

WB_PRE_XFORM_FILE = 'wb_pre_xform.yaml'
WB_POST_XFORM_FILE = 'wb_post_xform.yaml'
WF_PRE_XFORM_FILE = 'wf_pre_xform.yaml'
WF_POST_XFORM_FILE = 'wf_post_xform.yaml'
TEST_FIXTURES = {
    'workflows': [
        WB_PRE_XFORM_FILE,
        WB_POST_XFORM_FILE,
        WF_PRE_XFORM_FILE,
        WF_POST_XFORM_FILE
    ],
    'actions': ['local.yaml']
}

PACK = 'generic'
LOADER = FixturesLoader()
FIXTURES = LOADER.load_fixtures(fixtures_pack=PACK, fixtures_dict=TEST_FIXTURES)
WB_PRE_XFORM_PATH = LOADER.get_fixture_file_path_abs(PACK, 'workflows', WB_PRE_XFORM_FILE)
WB_PRE_XFORM_DEF = FIXTURES['workflows'][WB_PRE_XFORM_FILE]
WB_POST_XFORM_PATH = LOADER.get_fixture_file_path_abs(PACK, 'workflows', WB_POST_XFORM_FILE)
WB_POST_XFORM_DEF = FIXTURES['workflows'][WB_POST_XFORM_FILE]
WF_PRE_XFORM_PATH = LOADER.get_fixture_file_path_abs(PACK, 'workflows', WF_PRE_XFORM_FILE)
WF_PRE_XFORM_DEF = FIXTURES['workflows'][WF_PRE_XFORM_FILE]
WF_POST_XFORM_PATH = LOADER.get_fixture_file_path_abs(PACK, 'workflows', WF_POST_XFORM_FILE)
WF_POST_XFORM_DEF = FIXTURES['workflows'][WF_POST_XFORM_FILE]


def _read_file_content(path):
    with open(path, 'r') as f:
        return f.read()
开发者ID:Kailashkatheth1,项目名称:st2,代码行数:30,代码来源:test_mistral_dsl_transform.py


示例15: FixturesLoader

        'workflow_v2_many_workflows.yaml'
    ],
    'actions': [
        'workbook_v2.yaml',
        'workbook_v2_many_workflows.yaml',
        'workbook_v2_many_workflows_no_default.yaml',
        'workflow_v2.yaml',
        'workflow_v2_many_workflows.yaml',
        'workbook_v2_name_mismatch.yaml',
        'workflow_v2_name_mismatch.yaml',
        'local.yaml'
    ]
}

PACK = 'generic'
LOADER = FixturesLoader()
FIXTURES = LOADER.load_fixtures(fixtures_pack=PACK, fixtures_dict=TEST_FIXTURES)

MISTRAL_EXECUTION = {'id': str(uuid.uuid4()), 'state': 'RUNNING', 'workflow_name': None}

# Workbook with a single workflow
WB1_YAML_FILE_NAME = TEST_FIXTURES['workflows'][0]
WB1_YAML_FILE_PATH = LOADER.get_fixture_file_path_abs(PACK, 'workflows', WB1_YAML_FILE_NAME)
WB1_SPEC = FIXTURES['workflows'][WB1_YAML_FILE_NAME]
WB1_YAML = yaml.safe_dump(WB1_SPEC, default_flow_style=False)
WB1_NAME = '%s.%s' % (PACK, WB1_YAML_FILE_NAME.replace('.yaml', ''))
WB1 = workbooks.Workbook(None, {'name': WB1_NAME, 'definition': WB1_YAML})
WB1_OLD = workbooks.Workbook(None, {'name': WB1_NAME, 'definition': ''})
WB1_EXEC = copy.deepcopy(MISTRAL_EXECUTION)
WB1_EXEC['workflow_name'] = WB1_NAME
开发者ID:emptywee,项目名称:st2,代码行数:30,代码来源:test_mistral_v2.py


示例16: FixturesLoader

TEST_FIXTURES = {
    'actions': [
        'action1.yaml'
    ],
    'policytypes': [
        'fake_policy_type_1.yaml',
        'fake_policy_type_2.yaml'
    ],
    'policies': [
        'policy_1.yaml',
        'policy_2.yaml'
    ]
}

PACK = 'generic'
LOADER = FixturesLoader()
FIXTURES = LOADER.load_fixtures(fixtures_pack=PACK, fixtures_dict=TEST_FIXTURES)


@mock.patch.object(
    CUDPublisher, 'publish_update',
    mock.MagicMock(side_effect=MockExecutionPublisher.publish_update))
@mock.patch.object(
    CUDPublisher, 'publish_create',
    mock.MagicMock(return_value=None))
@mock.patch.object(
    LiveActionPublisher, 'publish_state',
    mock.MagicMock(side_effect=MockLiveActionPublisher.publish_state))
@mock.patch('st2common.runners.base.get_runner', mock.Mock(return_value=runner.get_runner()))
@mock.patch('st2actions.container.base.get_runner', mock.Mock(return_value=runner.get_runner()))
class SchedulingPolicyTest(ExecutionDbTestCase):
开发者ID:StackStorm,项目名称:st2,代码行数:31,代码来源:test_policies.py


示例17: setUpClass

    def setUpClass(cls):
        super(PolicyTest, cls).setUpClass()

        loader = FixturesLoader()
        loader.save_fixtures_to_db(fixtures_pack=PACK, fixtures_dict=TEST_FIXTURES)
开发者ID:azamsheriff,项目名称:st2,代码行数:5,代码来源:test_policies.py


示例18: FixturesLoader

    ],
    'actions': [
        'local.yaml',
        'a1.yaml',
        'a2.yaml',
        'action1.yaml'
    ],
    'runners': [
        'run-local.yaml',
        'testrunner1.yaml',
        'testrunner2.yaml'
    ]
}

PACK = 'generic'
LOADER = FixturesLoader()
FIXTURES = LOADER.load_fixtures(fixtures_pack=PACK, fixtures_dict=TEST_FIXTURES)
WB_PRE_XFORM_PATH = LOADER.get_fixture_file_path_abs(PACK, 'workflows', WB_PRE_XFORM_FILE)
WB_PRE_XFORM_DEF = FIXTURES['workflows'][WB_PRE_XFORM_FILE]
WB_POST_XFORM_PATH = LOADER.get_fixture_file_path_abs(PACK, 'workflows', WB_POST_XFORM_FILE)
WB_POST_XFORM_DEF = FIXTURES['workflows'][WB_POST_XFORM_FILE]
WF_PRE_XFORM_PATH = LOADER.get_fixture_file_path_abs(PACK, 'workflows', WF_PRE_XFORM_FILE)
WF_PRE_XFORM_DEF = FIXTURES['workflows'][WF_PRE_XFORM_FILE]
WF_POST_XFORM_PATH = LOADER.get_fixture_file_path_abs(PACK, 'workflows', WF_POST_XFORM_FILE)
WF_POST_XFORM_DEF = FIXTURES['workflows'][WF_POST_XFORM_FILE]
WF_JINJA_ST2KV_PRE_XFORM_PATH = LOADER.get_fixture_file_path_abs(
    PACK, 'workflows', WF_JINJA_ST2KV_PRE_XFORM_FILE)
WF_JINJA_ST2KV_PRE_XFORM_DEF = FIXTURES['workflows'][WF_JINJA_ST2KV_PRE_XFORM_FILE]
WF_JINJA_ST2KV_POST_XFORM_PATH = LOADER.get_fixture_file_path_abs(
    PACK, 'workflows', WF_JINJA_ST2KV_POST_XFORM_FILE)
WF_JINJA_MIXED_CTX1_DEF = FIXTURES['workflows'][WF_JINJA_MIXED_CTX1_FILE]
开发者ID:StackStorm,项目名称:st2,代码行数:31,代码来源:test_util_mistral_dsl_transform.py


示例19: setUp

 def setUp(self):
     super(TestPurgeExecutions, self).setUp()
     fixtures_loader = FixturesLoader()
     self.models = fixtures_loader.load_models(fixtures_pack='generic',
                                               fixtures_dict=TEST_FIXTURES)
开发者ID:lyandut,项目名称:st2,代码行数:5,代码来源:test_purge_executions.py


示例20: setUpClass

 def setUpClass(cls):
     super(TestExportWorker, cls).setUpClass()
     fixtures_loader = FixturesLoader()
     loaded_fixtures = fixtures_loader.save_fixtures_to_db(fixtures_pack=DESCENDANTS_PACK,
                                                           fixtures_dict=DESCENDANTS_FIXTURES)
     TestExportWorker.saved_executions = loaded_fixtures['executions']
开发者ID:AlexeyDeyneko,项目名称:st2,代码行数:6,代码来源:test_export_worker.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python gettextutils._函数代码示例发布时间:2022-05-27
下一篇:
Python fixturesloader.get_fixtures_packs_base_path函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap