def get_absolute_url(self): from remo.remozilla.models import Bug from remo.remozilla.utils import get_bugzilla_url obj = self.content_type.model_class().objects.get(pk=self.object_id) if isinstance(obj, Bug): return get_bugzilla_url(obj) else: return obj.get_absolute_url()
def automated_poll_discussion_email(sender, instance, created, raw, **kwargs): """Send email reminders when a vote starts/ends.""" if instance.automated_poll and created: template = 'emails/review_budget_notify_review_team.jinja' subject = u'Discuss [Bug {id}] - {summary}'.format(id=instance.bug.bug_id, summary=unicode(instance.bug.summary)) data = {'bug': instance.bug, 'BUGZILLA_URL': get_bugzilla_url(instance.bug), 'poll': instance} send_remo_mail.delay( subject=subject, email_template=template, recipients_list=[settings.REPS_REVIEW_ALIAS], data=data)
def test_send_discussion_email_to_council(self): bug = BugFactory.create(bug_id=989812) automated_poll = PollFactory.build( name='automated_poll', automated_poll=True, bug=bug) with patch('remo.voting.models.send_remo_mail') as mocked_send_mail: automated_poll_discussion_email(None, automated_poll, True, {}) subject = 'Discuss [Bug 989812] - Bug summary' data = {'bug': bug, 'BUGZILLA_URL': get_bugzilla_url(bug), 'poll': automated_poll} mocked_send_mail.delay.assert_called_once_with( subject=subject, email_template='emails/review_budget_notify_council.txt', recipients_list=[settings.REPS_COUNCIL_ALIAS], data=data)
def test_send_discussion_email_to_council(self): bug = BugFactory.create(bug_id=989812) automated_poll = PollFactory.build(name='automated_poll', automated_poll=True, bug=bug) with patch('remo.voting.models.send_remo_mail') as mocked_send_mail: automated_poll_discussion_email(None, automated_poll, True, {}) subject = 'Discuss [Bug 989812] - Bug summary' data = { 'bug': bug, 'BUGZILLA_URL': get_bugzilla_url(bug), 'poll': automated_poll } mocked_send_mail.delay.assert_called_once_with( subject=subject, email_template='emails/review_budget_notify_council.txt', recipients_list=[settings.REPS_COUNCIL_ALIAS], data=data)