def test_emails_goes_out(self): self.app1_review = Review.objects.create( webapp=self.app, user=self.user, rating=1, body='sux, I want my money back.') self.app1_review.update(created=self.days_ago(1)) email_daily_ratings() eq_(len(mail.outbox), 1) eq_(mail.outbox[0].to, [self.user.email]) eq_(str(self.app1_review.body) in smart_str(mail.outbox[0].body), True)
def test_emails_goes_out(self): self.app1_review = Review.objects.create( addon=self.app, user=self.user, rating=1, body='sux, I want my money back.') self.app1_review.update(created=self.days_ago(1)) email_daily_ratings() eq_(len(mail.outbox), 1) eq_(mail.outbox[0].to, [self.user.email]) eq_(str(self.app1_review.body) in smart_str(mail.outbox[0].body), True)
def test_emails_goes_out(self): # Test first email have one rating, second email has two ratings. email_daily_ratings() eq_(len(mail.outbox), 2) eq_(mail.outbox[0].to, [self.user.email]) eq_(mail.outbox[1].to, [self.user.email]) eq_(str(self.app1_review.body) in smart_str(mail.outbox[0].body), True) eq_(str(self.app2_review.body) in smart_str(mail.outbox[1].body), True) eq_(str(self.app2_review2.body) in smart_str(mail.outbox[1].body), True) eq_(str(self.app2_review.body) not in smart_str(mail.outbox[0].body), True) eq_(str(self.app2_review.body) not in smart_str(mail.outbox[0].body), True)
def test_one_email_for_multiple_reviews(self): self.app2_review = Review.objects.create( addon=self.app2, user=self.user, rating=4, body="waste of two seconds of my life." ) self.app2_review.update(created=self.days_ago(1)) self.app2_review2 = Review.objects.create( addon=self.app2, user=self.user, rating=5, body="a++ would play again" ) self.app2_review2.update(created=self.days_ago(1)) email_daily_ratings() eq_(len(mail.outbox), 1) eq_(mail.outbox[0].to, [self.user.email]) eq_(str(self.app2_review.body) in smart_str(mail.outbox[0].body), True) eq_(str(self.app2_review2.body) in smart_str(mail.outbox[0].body), True)
def test_emails_goes_out(self): # Test first email have one rating, second email has two ratings. email_daily_ratings() eq_(len(mail.outbox), 2) eq_(mail.outbox[0].to, [self.user.email]) eq_(mail.outbox[1].to, [self.user.email]) eq_(str(self.app1_review.body) in smart_str(mail.outbox[0].body), True) eq_(str(self.app2_review.body) in smart_str(mail.outbox[1].body), True) eq_( str(self.app2_review2.body) in smart_str(mail.outbox[1].body), True) eq_( str(self.app2_review.body) not in smart_str(mail.outbox[0].body), True) eq_( str(self.app2_review.body) not in smart_str(mail.outbox[0].body), True)
def test_one_email_for_multiple_reviews(self): self.app2_review = Review.objects.create( addon=self.app2, user=self.user, rating=4, body='waste of two seconds of my life.') self.app2_review.update(created=self.days_ago(1)) self.app2_review2 = Review.objects.create( addon=self.app2, user=self.user, rating=5, body='a++ would play again') self.app2_review2.update(created=self.days_ago(1)) email_daily_ratings() eq_(len(mail.outbox), 1) eq_(mail.outbox[0].to, [self.user.email]) eq_(str(self.app2_review.body) in smart_str(mail.outbox[0].body), True) eq_(str(self.app2_review2.body) in smart_str(mail.outbox[0].body), True)