コード例 #1
0
    def test_success(self):
        rules = list(self.project.rule_set.all())
        groups = [self.create_group() for _ in xrange(3)]

        groups[0].event_count = 10
        groups[0].user_count = 4

        groups[1].event_count = 5
        groups[1].user_count = 2

        groups[2].event_count = 5
        groups[2].user_count = 1

        grouped = {
            rules[0]: {
                groups[0]: [],
            },
            rules[1]: {
                groups[1]: [],
                groups[2]: [],
            },
        }

        assert sort_rule_groups(sort_group_contents(grouped)) == OrderedDict((
            (rules[1], OrderedDict((
                (groups[1], []),
                (groups[2], []),
            ))),
            (rules[0], OrderedDict(((groups[0], []), ))),
        ))
コード例 #2
0
    def test_success(self):
        rules = list(self.project.rule_set.all())
        groups = [self.create_group() for _ in xrange(3)]

        groups[0].event_count = 10
        groups[0].user_count = 4

        groups[1].event_count = 5
        groups[1].user_count = 2

        groups[2].event_count = 5
        groups[2].user_count = 1

        grouped = {
            rules[0]: {
                groups[0]: [],
            },
            rules[1]: {
                groups[1]: [],
                groups[2]: [],
            },
        }

        assert sort_rule_groups(sort_group_contents(grouped)) == OrderedDict((
            (rules[1], OrderedDict((
                (groups[1], []),
                (groups[2], []),
            ))),
            (rules[0], OrderedDict((
                (groups[0], []),
            ))),
        ))
コード例 #3
0
    def test_success(self):
        Rule.objects.create(
            project=self.project,
            label="Send a notification for regressions",
            data={
                "match": "all",
                "conditions": [
                    {"id": "sentry.rules.conditions.regression_event.RegressionEventCondition"}
                ],
                "actions": [{"id": "sentry.rules.actions.notify_event.NotifyEventAction"}],
            },
        )

        rules = list(self.project.rule_set.all())
        groups = [self.create_group() for _ in range(3)]

        groups[0].event_count = 10
        groups[0].user_count = 4

        groups[1].event_count = 5
        groups[1].user_count = 2

        groups[2].event_count = 5
        groups[2].user_count = 1

        grouped = {rules[0]: {groups[0]: []}, rules[1]: {groups[1]: [], groups[2]: []}}

        assert sort_rule_groups(sort_group_contents(grouped)) == OrderedDict(
            (
                (rules[1], OrderedDict(((groups[1], []), (groups[2], [])))),
                (rules[0], OrderedDict(((groups[0], []),))),
            )
        )
コード例 #4
0
    def test_success(self):
        Rule.objects.create(
            project=self.project,
            label='Send a notification for regressions',
            data={
                'match':
                'all',
                'conditions': [
                    {
                        'id':
                        'sentry.rules.conditions.regression_event.RegressionEventCondition'
                    },
                ],
                'actions': [
                    {
                        'id':
                        'sentry.rules.actions.notify_event.NotifyEventAction'
                    },
                ],
            })

        rules = list(self.project.rule_set.all())
        groups = [self.create_group() for _ in range(3)]

        groups[0].event_count = 10
        groups[0].user_count = 4

        groups[1].event_count = 5
        groups[1].user_count = 2

        groups[2].event_count = 5
        groups[2].user_count = 1

        grouped = {
            rules[0]: {
                groups[0]: [],
            },
            rules[1]: {
                groups[1]: [],
                groups[2]: [],
            },
        }

        assert sort_rule_groups(sort_group_contents(grouped)) == OrderedDict((
            (rules[1], OrderedDict((
                (groups[1], []),
                (groups[2], []),
            ))),
            (rules[0], OrderedDict(((groups[0], []), ))),
        ))
コード例 #5
0
ファイル: test_notifications.py プロジェクト: Kayle009/sentry
    def test_success(self):
        Rule.objects.create(
            project=self.project,
            label='Send a notification for regressions',
            data={
                'match':
                'all',
                'conditions': [
                    {
                        'id': 'sentry.rules.conditions.regression_event.RegressionEventCondition'
                    },
                ],
                'actions': [
                    {
                        'id': 'sentry.rules.actions.notify_event.NotifyEventAction'
                    },
                ],
            }
        )

        rules = list(self.project.rule_set.all())
        groups = [self.create_group() for _ in range(3)]

        groups[0].event_count = 10
        groups[0].user_count = 4

        groups[1].event_count = 5
        groups[1].user_count = 2

        groups[2].event_count = 5
        groups[2].user_count = 1

        grouped = {
            rules[0]: {
                groups[0]: [],
            },
            rules[1]: {
                groups[1]: [],
                groups[2]: [],
            },
        }

        assert sort_rule_groups(sort_group_contents(grouped)) == OrderedDict(
            (
                (rules[1], OrderedDict(((groups[1], []), (groups[2], []), ))),
                (rules[0], OrderedDict(((groups[0], []), ))),
            )
        )