def testRender_html(self): from processes import render_html, post_from_file from objects import Link from mako.template import Template p1 = post_from_file(open(self.test_post_file)) p2 = post_from_file(open(self.test_post_file2)) posts = [p1, p2] footlinks = [Link("http://github.com/", "github"), Link("http://github.com/schatten/", "my github")] template = Template(open(self.test_layout_template).read()) title = "Hello World" self.assertEqual(render_html(posts, title, footlinks, template), u'<html>\n <head>\n <title>Hello World | sitename.com</title>\n </head>\n <body>\n <h1>Hello World</h1>\n\n July, 2007\n <a href="/archive/1.html">Post 1</a>\n <p>contents</p>\n July, 2007\n <a href="/archive/2.html">Post 2</a>\n <p>contents</p>\n\n <a href="http://github.com/">github</a>\n <a href="http://github.com/schatten/">my github</a>\n </body>\n</html>\n' )
def testPost_from_file(self): from processes import post_from_file p = post_from_file(open(self.test_post_file)) assert(isinstance(p, Post)) self.assertEqual(p.uid, '1')