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')
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
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, ['*****@*****.**'])