def _create_trigger(self, ctx, **kwargs): spec = parser.simple_parse(sample_trigger) data = {} data['id'] = None data['desc'] = 'a description' data['name'] = 'test_trigger' data['physical_id'] = None data['enabled'] = True data['state'] = 'ok' data['severity'] = 'low' data['links'] = {} data['type'] = spec['type'] data['spec'] = spec data['user'] = ctx.user data['project'] = ctx.project data['domain'] = ctx.domain data.update(kwargs) return db_api.trigger_create(ctx, data)
def _create_db_trigger(self, trigger_id=None, **custom_values): values = { 'id': trigger_id, 'name': 'test-trigger', 'type': 'FakeTriggerType', 'desc': 'blah blah', 'state': base.INSUFFICIENT_DATA, 'enabled': True, 'severity': base.S_CRITICAL, 'links': { 'alarm_actions': ['http://url1'] }, 'spec': parser.simple_parse(sample_trigger), 'user': self.ctx.user, 'project': self.ctx.project, 'domain': self.ctx.domain } values.update(custom_values) return db_api.trigger_create(self.ctx, values)