From 77f0b522e1a16b1dba36432d5aa7a099bfe84403 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Sat, 19 Dec 2015 17:41:41 -0500 Subject: updated lps_gen.RenderHTML - Now handles the case when the template does not exist. - HTML output is now prettified by BeautifulSoup. --- tests/test_lps_gen.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests') diff --git a/tests/test_lps_gen.py b/tests/test_lps_gen.py index cab3fa8..8473955 100644 --- a/tests/test_lps_gen.py +++ b/tests/test_lps_gen.py @@ -22,8 +22,10 @@ import json import pprint import mistune +import mock from os import path +from StringIO import StringIO from nose.tools import * @@ -161,6 +163,18 @@ class TestLpsGen(object): print lps_html + def test_RenderHTML_invalid_year(self): + """Testing `RenderHTML` function - with invalid year + """ + with mock.patch('sys.stdout', new_callable=StringIO) as out: + invalid_year = '2016_invalid' + template_name = 'lp-sch-%s.jinja2' % invalid_year + + lps_html = RenderHTML(self.lps_dict, invalid_year) + expected_out = 'Template %s not found.\n' % template_name + assert out.getvalue() == expected_out + + def teardown(self): """Cleans up things after each test in this class.""" pass -- cgit v1.2.3