예제 #1
0
    def test_notify_about_previous_activity(self, send_mail_mock):
        # Create an activity to use when notifying.
        activity = self._create(amo.LOG.REQUEST_INFORMATION, self.reviewer)
        notify_about_activity_log(self.addon, self.version, activity)
        assert ActivityLog.objects.count() == 1  # No new activity created.

        assert send_mail_mock.call_count == 2  # Both authors.
        sender = '%s <notifications@%s>' % (self.reviewer.name,
                                            settings.INBOUND_EMAIL_DOMAIN)
        assert sender == send_mail_mock.call_args_list[0][1]['from_email']
        recipients = self._recipients(send_mail_mock)
        assert len(recipients) == 2
        assert self.developer.email in recipients
        assert self.developer2.email in recipients
        # The reviewer who sent it doesn't get their email back.
        assert self.reviewer.email not in recipients

        self._check_email_info_request(
            send_mail_mock.call_args_list[0],
            absolutify(self.addon.get_dev_url('versions')),
            'you are listed as an author of this add-on.',
            days_text=None)
        self._check_email_info_request(
            send_mail_mock.call_args_list[1],
            absolutify(self.addon.get_dev_url('versions')),
            'you are listed as an author of this add-on.',
            days_text=None)
예제 #2
0
    def test_notify_about_previous_activity(self, send_mail_mock):
        # Create an activity to use when notifying.
        activity = self._create(amo.LOG.REVIEWER_REPLY_VERSION, self.reviewer)
        notify_about_activity_log(self.addon, self.version, activity)
        assert ActivityLog.objects.count() == 1  # No new activity created.

        assert send_mail_mock.call_count == 2  # Both authors.
        sender = formataddr(
            (self.reviewer.reviewer_name, NOTIFICATIONS_FROM_EMAIL))
        assert sender == send_mail_mock.call_args_list[0][1]['from_email']
        recipients = self._recipients(send_mail_mock)
        assert len(recipients) == 2
        assert self.developer.email in recipients
        assert self.developer2.email in recipients
        # The reviewer who sent it doesn't get their email back.
        assert self.reviewer.email not in recipients

        self._check_email(
            send_mail_mock.call_args_list[0],
            absolutify(self.addon.get_dev_url('versions')),
            'you are listed as an author of this add-on.',
        )
        self._check_email(
            send_mail_mock.call_args_list[1],
            absolutify(self.addon.get_dev_url('versions')),
            'you are listed as an author of this add-on.',
        )
예제 #3
0
    def test_notify_about_previous_activity(self, send_mail_mock):
        # Create an activity to use when notifying.
        activity = self._create(amo.LOG.REQUEST_INFORMATION, self.reviewer)
        notify_about_activity_log(self.addon, self.version, activity)
        assert ActivityLog.objects.count() == 1  # No new activity created.

        assert send_mail_mock.call_count == 2  # Both authors.
        sender = '%s <notifications@%s>' % (
            self.reviewer.name, settings.INBOUND_EMAIL_DOMAIN)
        assert sender == send_mail_mock.call_args_list[0][1]['from_email']
        recipients = self._recipients(send_mail_mock)
        assert len(recipients) == 2
        assert self.developer.email in recipients
        assert self.developer2.email in recipients
        # The reviewer who sent it doesn't get their email back.
        assert self.reviewer.email not in recipients

        self._check_email_info_request(
            send_mail_mock.call_args_list[0],
            absolutify(self.addon.get_dev_url('versions')),
            'you are listed as an author of this add-on.',
            days_text=None)
        self._check_email_info_request(
            send_mail_mock.call_args_list[1],
            absolutify(self.addon.get_dev_url('versions')),
            'you are listed as an author of this add-on.',
            days_text=None)
 def handle(self, *args, **options):
     # Fetch addons with request for information expiring in one day.
     one_day_in_the_future = datetime.now() + timedelta(days=1)
     qs = Addon.objects.filter(
         addonreviewerflags__notified_about_expiring_info_request=False,
         addonreviewerflags__pending_info_request__lt=one_day_in_the_future)
     for addon in qs:
         # The note we need to send the mail should always going to be the
         # last information request, as making a new one extends the
         # deadline.
         note = ActivityLog.objects.for_addons(addon).filter(
             action=amo.LOG.REQUEST_INFORMATION.id).latest('pk')
         version = note.versionlog_set.latest('pk').version
         log.info('Notifying developers of %s about expiring info request',
                  addon.pk)
         # This re-sends the notification sent when the information was
         # requested, but with the new delay in the body of the email now
         # that the notification is about to expire.
         notify_about_activity_log(addon,
                                   version,
                                   note,
                                   perm_setting=reviewer_reviewed.short,
                                   send_to_reviewers=False,
                                   send_to_staff=False)
         addon.addonreviewerflags.update(
             notified_about_expiring_info_request=True)
 def handle(self, *args, **options):
     # Fetch addons with request for information expiring in one day.
     one_day_in_the_future = datetime.now() + timedelta(days=1)
     qs = Addon.objects.filter(
         addonreviewerflags__notified_about_expiring_info_request=False,
         addonreviewerflags__pending_info_request__lt=one_day_in_the_future)
     for addon in qs:
         # The note we need to send the mail should always going to be the
         # last information request, as making a new one extends the
         # deadline.
         note = ActivityLog.objects.for_addons(addon).filter(
             action=amo.LOG.REQUEST_INFORMATION.id).latest('pk')
         version = note.versionlog_set.latest('pk').version
         log.info(
             'Notifying developers of %s about expiring info request',
             addon.pk)
         # This re-sends the notification sent when the information was
         # requested, but with the new delay in the body of the email now
         # that the notification is about to expire.
         notify_about_activity_log(
             addon, version, note, perm_setting=reviewer_reviewed.short,
             send_to_reviewers=False, send_to_staff=False)
         addon.addonreviewerflags.update(
             notified_about_expiring_info_request=True)