Beispiel #1
0
    def test_get_participants_without_actor(self):
        group, (user, ) = self.get_fixture_data(1)

        email = ActivityEmail(Activity(
            project=group.project,
            group=group,
        ))

        assert set(email.get_participants()) == set([user])
Beispiel #2
0
    def test_get_subject(self):
        group, (user, ) = self.get_fixture_data(1)

        email = ActivityEmail(Activity(
            project=group.project,
            group=group,
        ))

        with mock.patch('sentry.models.ProjectOption.objects.get_value') as get_value:
            get_value.side_effect = lambda project, key, default=None: \
                "[Example prefix] " if key == "mail:subject_prefix" else default
            assert email.get_subject_with_prefix().startswith('[Example prefix] ')
Beispiel #3
0
    def test_get_participants(self):
        group, (actor, other) = self.get_fixture_data(2)

        email = ActivityEmail(Activity(
            project=group.project,
            group=group,
            user=actor,
        ))

        assert set(email.get_participants()) == set([other])

        UserOption.objects.set_value(user=actor, key='self_notifications', value='1')

        assert set(email.get_participants()) == set([actor, other])
Beispiel #4
0
    def test_get_subject(self):
        group, (user, ) = self.get_fixture_data(1)

        email = ActivityEmail(Activity(
            project=group.project,
            group=group,
        ))

        with mock.patch(
                'sentry.models.ProjectOption.objects.get_value') as get_value:
            get_value.side_effect = lambda project, key, default=None: \
                "[Example prefix] " if key == "mail:subject_prefix" else default
            assert email.get_subject_with_prefix().startswith(
                '[Example prefix] ')
Beispiel #5
0
    def test_get_participants(self):
        group, (actor, other) = self.get_fixture_data(2)

        email = ActivityEmail(
            Activity(
                project=group.project,
                group=group,
                user=actor,
            ))

        assert set(email.get_participants()) == set([other])

        UserOption.objects.set_value(user=actor,
                                     key='self_notifications',
                                     value='1')

        assert set(email.get_participants()) == set([actor, other])
Beispiel #6
0
    def test_get_participants_without_actor(self):
        group, (user, ) = self.get_fixture_data(1)

        email = ActivityEmail(Activity(project=group.project, group=group))

        assert set(email.get_participants()) == set([user])