def test_render_template_index(self, mock_gen_post_index, mock_env): mock_gen_post_index.return_value = (1, 2) meta = {"title": "title", "template": u"Index", "filename": "file1.md", "path": "wintersun/posts"} contents = "Lorem ipsum " * 100 wintersun.render_template(contents, meta) self.assertTrue(mock_gen_post_index.called)
def test_render_template_post(self, mock_env): mock_template = mock.Mock() mock_env.get_template.return_value = mock_template meta = {"title": "title", "template": "Post", "filename": "file1.md", "path": "wintersun/posts"} contents = "Lorem ipsum " * 100 wintersun.render_template(contents, meta) mock_env.get_template.assert_called_with("post.html") self.assertTrue(mock_template.render.called)