예제 #1
0
def test_send_activity_mail():
    subject = u'This ïs ã subject'
    message = u'And... this ïs a messãge!'
    addon = addon_factory()
    latest_version = addon.find_latest_version(
        channel=amo.RELEASE_CHANNEL_LISTED)
    user = user_factory()
    recipients = [user, ]
    from_email = '*****@*****.**'
    action = ActivityLog.create(amo.LOG.DEVELOPER_REPLY_VERSION, user=user)
    send_activity_mail(
        subject, message, latest_version, recipients, from_email, action.id)

    assert len(mail.outbox) == 1
    assert mail.outbox[0].body == message
    assert mail.outbox[0].subject == subject
    uuid = latest_version.token.get(user=user).uuid.hex
    reference_header = '<{addon}/{version}@{site}>'.format(
        addon=latest_version.addon.id, version=latest_version.id,
        site=settings.INBOUND_EMAIL_DOMAIN)
    message_id = '<{addon}/{version}/{action}@{site}>'.format(
        addon=latest_version.addon.id, version=latest_version.id,
        action=action.id, site=settings.INBOUND_EMAIL_DOMAIN)

    assert mail.outbox[0].extra_headers['In-Reply-To'] == reference_header
    assert mail.outbox[0].extra_headers['References'] == reference_header
    assert mail.outbox[0].extra_headers['Message-ID'] == message_id

    reply_email = 'reviewreply+%s@%s' % (uuid, settings.INBOUND_EMAIL_DOMAIN)
    assert mail.outbox[0].reply_to == [reply_email]
예제 #2
0
    def notify_email(self, template, subject,
                     perm_setting='reviewer_reviewed', version=None):
        """Notify the authors that their addon has been reviewed."""
        if version is None:
            version = self.version
        data = self.data.copy() if self.data else {}
        data.update(self.get_context_data())
        data['tested'] = ''
        os, app = data.get('operating_systems'), data.get('applications')
        if os and app:
            data['tested'] = 'Tested on %s with %s' % (os, app)
        elif os and not app:
            data['tested'] = 'Tested on %s' % os
        elif not os and app:
            data['tested'] = 'Tested with %s' % app
        subject = subject % (data['name'],
                             self.version.version if self.version else '')
        unique_id = (self.log_entry.id if hasattr(self, 'log_entry')
                     else random.randrange(100000))

        message = loader.get_template(
            'reviewers/emails/%s.ltxt' % template).render(data)
        send_activity_mail(
            subject, message, version, self.addon.authors.all(),
            settings.NOBODY_EMAIL, unique_id, perm_setting=perm_setting)
예제 #3
0
    def notify_email(self, template, subject, perm_setting='editor_reviewed'):
        """Notify the authors that their addon has been reviewed."""
        data = self.data.copy() if self.data else {}
        data.update(self.get_context_data())
        data['tested'] = ''
        os, app = data.get('operating_systems'), data.get('applications')
        if os and app:
            data['tested'] = 'Tested on %s with %s' % (os, app)
        elif os and not app:
            data['tested'] = 'Tested on %s' % os
        elif not os and app:
            data['tested'] = 'Tested with %s' % app
        subject = subject % (data['name'],
                             self.version.version if self.version else '')

        message = loader.get_template(
            'editors/emails/%s.ltxt' % template).render(
            Context(data, autoescape=False))
        if not waffle.switch_is_active('activity-email'):
            emails = [a.email for a in self.addon.authors.all()]
            amo_send_mail(
                subject, message, recipient_list=emails,
                from_email=settings.EDITORS_EMAIL, use_deny_list=False,
                perm_setting=perm_setting)
        else:
            send_activity_mail(
                subject, message, self.version, self.addon.authors.all(),
                settings.EDITORS_EMAIL, perm_setting)
예제 #4
0
def test_send_activity_mail():
    subject = u'This ïs ã subject'
    message = u'And... this ïs a messãge!'
    addon = addon_factory()
    latest_version = addon.find_latest_version(
        channel=amo.RELEASE_CHANNEL_LISTED)
    user = user_factory()
    recipients = [user, ]
    from_email = '*****@*****.**'
    send_activity_mail(
        subject, message, latest_version, recipients, from_email)

    assert len(mail.outbox) == 1
    assert mail.outbox[0].body == message
    assert mail.outbox[0].subject == subject

    uuid = latest_version.token.get(user=user).uuid.hex
    reply_email = 'reviewreply+%s@%s' % (uuid, settings.INBOUND_EMAIL_DOMAIN)
    assert mail.outbox[0].reply_to == [reply_email]
예제 #5
0
    def notify_email(self, template, subject, perm_setting='editor_reviewed'):
        """Notify the authors that their addon has been reviewed."""
        data = self.data.copy() if self.data else {}
        data.update(self.get_context_data())
        data['tested'] = ''
        os, app = data.get('operating_systems'), data.get('applications')
        if os and app:
            data['tested'] = 'Tested on %s with %s' % (os, app)
        elif os and not app:
            data['tested'] = 'Tested on %s' % os
        elif not os and app:
            data['tested'] = 'Tested with %s' % app
        subject = subject % (data['name'],
                             self.version.version if self.version else '')

        message = loader.get_template('editors/emails/%s.ltxt' %
                                      template).render(
                                          Context(data, autoescape=False))
        send_activity_mail(subject, message, self.version,
                           self.addon.authors.all(), settings.EDITORS_EMAIL,
                           perm_setting)
예제 #6
0
def test_send_activity_mail():
    subject = u'This ïs ã subject'
    message = u'And... this ïs a messãge!'
    addon = addon_factory()
    latest_version = addon.find_latest_version(
        channel=amo.RELEASE_CHANNEL_LISTED)
    user = user_factory()
    recipients = [
        user,
    ]
    from_email = '*****@*****.**'
    send_activity_mail(subject, message, latest_version, recipients,
                       from_email)

    assert len(mail.outbox) == 1
    assert mail.outbox[0].body == message
    assert mail.outbox[0].subject == subject

    uuid = latest_version.token.get(user=user).uuid.hex
    reply_email = 'reviewreply+%s@%s' % (uuid, settings.INBOUND_EMAIL_DOMAIN)
    assert mail.outbox[0].reply_to == [reply_email]
예제 #7
0
def test_send_activity_mail():
    subject = 'This ïs ã subject'
    message = 'And... this ïs a messãge!'
    addon = addon_factory()
    latest_version = addon.find_latest_version(
        channel=amo.RELEASE_CHANNEL_LISTED)
    user = user_factory()
    recipients = [
        user,
    ]
    from_email = '*****@*****.**'
    action = ActivityLog.create(amo.LOG.DEVELOPER_REPLY_VERSION, user=user)
    send_activity_mail(subject, message, latest_version, recipients,
                       from_email, action.id)

    assert len(mail.outbox) == 1
    assert mail.outbox[0].body == message
    assert mail.outbox[0].subject == subject
    uuid = latest_version.token.get(user=user).uuid.hex
    reference_header = '<{addon}/{version}@{site}>'.format(
        addon=latest_version.addon.id,
        version=latest_version.id,
        site=settings.INBOUND_EMAIL_DOMAIN,
    )
    message_id = '<{addon}/{version}/{action}@{site}>'.format(
        addon=latest_version.addon.id,
        version=latest_version.id,
        action=action.id,
        site=settings.INBOUND_EMAIL_DOMAIN,
    )

    assert mail.outbox[0].extra_headers['In-Reply-To'] == reference_header
    assert mail.outbox[0].extra_headers['References'] == reference_header
    assert mail.outbox[0].extra_headers['Message-ID'] == message_id

    reply_email = f'reviewreply+{uuid}@{settings.INBOUND_EMAIL_DOMAIN}'
    assert mail.outbox[0].reply_to == [reply_email]