|
@@ -391,12 +391,28 @@ class Fixtures:
|
|
|
projects = [self.project]
|
|
|
return Factories.create_alert_rule(organization, projects, *args, **kwargs)
|
|
|
|
|
|
- def create_alert_rule_activation(self, alert_rule=None, *args, **kwargs):
|
|
|
+ def create_alert_rule_activation(
|
|
|
+ self, alert_rule=None, query_subscriptions=None, project=None, *args, **kwargs
|
|
|
+ ):
|
|
|
if not alert_rule:
|
|
|
alert_rule = self.create_alert_rule(
|
|
|
monitor_type=AlertRuleMonitorType.ACTIVATED,
|
|
|
)
|
|
|
- return Factories.create_alert_rule_activation(alert_rule=alert_rule, *args, **kwargs)
|
|
|
+ if not query_subscriptions:
|
|
|
+ projects = [project] if project else [self.project]
|
|
|
+ query_subscriptions = alert_rule.subscribe_projects(
|
|
|
+ projects=projects,
|
|
|
+ monitor_type=AlertRuleMonitorType.ACTIVATED,
|
|
|
+ )
|
|
|
+
|
|
|
+ created_activations = []
|
|
|
+ for sub in query_subscriptions:
|
|
|
+ created_activations.append(
|
|
|
+ Factories.create_alert_rule_activation(
|
|
|
+ alert_rule=alert_rule, query_subscription=sub, *args, **kwargs
|
|
|
+ )
|
|
|
+ )
|
|
|
+ return created_activations
|
|
|
|
|
|
def create_alert_rule_trigger(self, alert_rule=None, *args, **kwargs):
|
|
|
if not alert_rule:
|