diff options
author | rsiddharth <rsd@gnu.org> | 2015-12-19 17:41:41 -0500 |
---|---|---|
committer | rsiddharth <rsd@gnu.org> | 2015-12-19 17:41:41 -0500 |
commit | 77f0b522e1a16b1dba36432d5aa7a099bfe84403 (patch) | |
tree | 799755555aa8dc9e7f219c65619a4f74e1650d79 /tests | |
parent | bf36773eeb0c858d064e13c96a2fd2e93757f710 (diff) |
updated lps_gen.RenderHTML
- Now handles the case when the template does not exist.
- HTML output is now prettified by BeautifulSoup.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_lps_gen.py | 14 |
1 files changed, 14 insertions, 0 deletions
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 |