FIXTURES_1 = { 'runners': ['testrunner1.yaml', 'testrunner2.yaml'], 'actions': ['action1.yaml', 'a2.yaml'], 'triggertypes': ['triggertype1.yaml'], 'triggers': ['trigger1.yaml'] } FIXTURES_2 = {'rules': ['rule1.yaml', 'rule2.yaml']} MOCK_TRIGGER_INSTANCE = TriggerInstanceDB() MOCK_TRIGGER_INSTANCE.id = 'triggerinstance-test' MOCK_TRIGGER_INSTANCE.payload = {'t1_p': 't1_p_v'} MOCK_TRIGGER_INSTANCE.occurrence_time = date_utils.get_datetime_utc_now() MOCK_LIVEACTION = LiveActionDB() MOCK_LIVEACTION.id = 'liveaction-test-1.id' MOCK_LIVEACTION.name = 'liveaction-test-1.name' MOCK_LIVEACTION.status = 'requested' class EnforceTest(DbTestCase): models = None @classmethod def setUpClass(cls): super(EnforceTest, cls).setUpClass() # 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_1) cls.models.update(FixturesLoader().save_fixtures_to_db(
'actions': ['action1.yaml', 'a2.yaml'], 'triggertypes': ['triggertype1.yaml'], 'triggers': ['trigger1.yaml'] } FIXTURES_2 = { 'rules': ['rule1.yaml', 'rule2.yaml'] } MOCK_TRIGGER_INSTANCE = TriggerInstanceDB() MOCK_TRIGGER_INSTANCE.id = 'triggerinstance-test' MOCK_TRIGGER_INSTANCE.payload = {'t1_p': 't1_p_v'} MOCK_TRIGGER_INSTANCE.occurrence_time = datetime.datetime.utcnow() MOCK_LIVEACTION = LiveActionDB() MOCK_LIVEACTION.id = 'liveaction-test-1.id' MOCK_LIVEACTION.name = 'liveaction-test-1.name' MOCK_LIVEACTION.status = 'requested' class EnforceTest(DbTestCase): models = None @classmethod def setUpClass(cls): super(EnforceTest, cls).setUpClass() # 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_1) cls.models.update(FixturesLoader().save_fixtures_to_db(