Beispiel #1
0
 def test_event_groups(self):
     groups = loggers.get_event_groups()
     group = list(groups.keys())[0]
     self.system_notification.event_groups = [group]
     self.system_notification.event_types = []
     self.system_notification.save()
     self.event.event_type = list(groups[group])[0]
     self.event.save()
     tasks.process_event(self.event.id)
     self.assertEqual(len(mail.outbox), 1)
     self.assertTrue(self.admin.email in mail.outbox[0].to)
Beispiel #2
0
class BaseHookForm(forms.ModelForm):
    event_types = JSONMultipleChoiceField(
        choices=lambda: [(e, e) for e in get_valid_events()],
        widget=forms.SelectMultiple(attrs={'size': '30'}),
        required=False,
    )

    event_groups = JSONMultipleChoiceField(
        choices=lambda: [(g, g) for g in get_event_groups()],
        widget=forms.SelectMultiple(attrs={'size': '30'}),
        required=False,
    )
Beispiel #3
0
 def event_groups(self, request, *args, **kwargs):
     """
     Returns a list of groups with event types.
     Group is used in exclude_features query param.
     """
     return response.Response(get_event_groups())