def test_format_file_comment_msg(self): detail = file_comment_msg_to_json(self.repo.id, self.file, self.user.username, 'test comment') notice = UserNotification.objects.add_file_comment_msg('*****@*****.**', detail) msg = notice.format_file_comment_msg() assert msg is not None assert 'new comment from user' in msg
def test_send_file_comment_notice(self): self.assertEqual(len(mail.outbox), 0) detail = file_comment_msg_to_json(self.repo.id, '/foo', self.user.username, 'test comment') UserNotification.objects.add_file_comment_msg('*****@*****.**', detail) call_command('send_notices') self.assertEqual(len(mail.outbox), 1) assert mail.outbox[0].to[0] == '*****@*****.**' assert 'new comment from user %s' % self.user.username in mail.outbox[0].body assert '/foo' in mail.outbox[0].body
def test_send_file_comment_notice(self): self.assertEqual(len(mail.outbox), 0) detail = file_comment_msg_to_json(self.repo.id, '/foo', '*****@*****.**', 'test comment') UserNotification.objects.add_file_comment_msg(self.user.username, detail) call_command('send_notices') self.assertEqual(len(mail.outbox), 1) assert mail.outbox[0].to[0] == self.user.username assert 'new comment from user %s' % '*****@*****.**' in mail.outbox[0].body assert '/foo' in mail.outbox[0].body