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])
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] ')
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])
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] ')
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])
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])