コード例 #1
0
ファイル: test_util.py プロジェクト: mozilla/firefox-flicks
 def test_no_profile(self, use_lang):
     """
     If the user has no profile, use the installation's default language
     code for the email locale.
     """
     user = UserFactory.create(email='*****@*****.**')
     video = VideoFactory.create(user=user)
     send_approval_email(video)
     eq_(len(mail.outbox), 1)
     eq_(mail.outbox[0].to, ['*****@*****.**'])
     use_lang.assert_called_with('fr')
コード例 #2
0
ファイル: models.py プロジェクト: solarce/firefox-flicks
    def save(self, *args, **kwargs):
        """
        Prior to saving, trigger approval processing if approval status has
        changed.
        """
        original = get_object_or_none(Video2013, id=self.id)

        # Only process approval if the value changed.
        if original and original.approved != self.approved:
            self.process_approval()

        # Save after processing to prevent making the video public until
        # processing is complete.
        return_value = super(Video2013, self).save(*args, **kwargs)

        # Send an email out if the user hasn't been notified and re-save.
        # Don't send an email out if this is a new, already-approved video.
        if original and self.approved and not self.user_notified:
            send_approval_email(self)
            self.user_notified = True
            return_value = super(Video2013, self).save(*args, **kwargs)

        return return_value
コード例 #3
0
ファイル: models.py プロジェクト: bensternthal/firefox-flicks
    def save(self, *args, **kwargs):
        """
        Prior to saving, trigger approval processing if approval status has
        changed.
        """
        original = get_object_or_none(Video2013, id=self.id)

        # Only process approval if the value changed.
        if original and original.approved != self.approved:
            self.process_approval()

        # Save after processing to prevent making the video public until
        # processing is complete.
        return_value = super(Video2013, self).save(*args, **kwargs)

        # Send an email out if the user hasn't been notified and re-save.
        # Don't send an email out if this is a new, already-approved video.
        if original and self.approved and not self.user_notified:
            send_approval_email(self)
            self.user_notified = True
            return_value = super(Video2013, self).save(*args, **kwargs)

        return return_value
コード例 #4
0
ファイル: test_util.py プロジェクト: mozilla/firefox-flicks
 def test_basic(self):
     user = UserProfileFactory.create(user__email='*****@*****.**').user
     video = VideoFactory.create(user=user)
     send_approval_email(video)
     eq_(len(mail.outbox), 1)
     eq_(mail.outbox[0].to, ['*****@*****.**'])