Exemplo n.º 1
0
    def test02_comment_email(self):
        """ Test Comment Email """
        comment_text = 'this is a test for comment email'
        with self.app.app_context():
            with self.app.config['mail'].record_messages() as outbox:
                with self.app.test_request_context():
                    send_comment_email(commenter='test_commenter',
                                       comment_text=comment_text,
                                       path=self.post_path)

            assert len(outbox) == 1
            assert outbox[0].subject == "Someone commented on your post!"
            # assert format_commenter(commenter) in outbox[0].body
            assert comment_text in outbox[0].body

            title = self.repo.post(self.post_path).headers['title']
            assert title in outbox[0].body
Exemplo n.º 2
0
    def test02_comment_email(self):
        """ Test Comment Email """
        comment_text = 'this is a test for comment email'
        with self.app.app_context():
            with self.app.config['mail'].record_messages() as outbox:
                with self.app.test_request_context():
                    send_comment_email(commenter='test_commenter',
                                       comment_text=comment_text,
                                       path=self.post_path)

            assert len(outbox) == 1
            assert outbox[0].subject == "Someone commented on your post!"
            # assert format_commenter(commenter) in outbox[0].body
            assert comment_text in outbox[0].body

            title = self.repo.post(self.post_path).headers['title']
            assert title in outbox[0].body
Exemplo n.º 3
0
    def test02_comment_email(self):
        """ Test Comment Email """
        with self.app.app_context():
            with self.app.config['mail'].record_messages() as outbox:
                with self.app.test_request_context():
                    commenter = 'test_commenter'
                    comment_text = 'this is a test for comment email'
                    send_comment_email(commenter=commenter,
                                       comment_text=comment_text,
                                       post_id=self.git_post_id)

            git_post = (db_session.query(Post).filter(
                Post.id == self.git_post_id).first())
            assert len(outbox) == 1
            assert outbox[0].subject == "Someone commented on your post!"
            # assert format_commenter(commenter) in outbox[0].body
            assert comment_text in outbox[0].body
            assert git_post.title in outbox[0].body