def test_new_issue_mail(self): user = UserFactory() owner = UserFactory() message = Message(content=faker.sentence(), posted_by=user) issue = Issue.objects.create(subject=DatasetFactory(owner=owner), user=user, title=faker.sentence(), discussion=[message]) with capture_mails() as mails: notify_new_issue(issue) # Should have sent one mail to the owner self.assertEqual(len(mails), 1) self.assertEqual(mails[0].recipients[0], owner.email)
def test_new_issue_mail(self): user = UserFactory() owner = UserFactory() message = Message(content=faker.sentence(), posted_by=user) issue = Issue.objects.create( subject=DatasetFactory(owner=owner), user=user, title=faker.sentence(), discussion=[message] ) with capture_mails() as mails: notify_new_issue(issue) # Should have sent one mail to the owner self.assertEqual(len(mails), 1) self.assertEqual(mails[0].recipients[0], owner.email)