""" This should be the place to test the functinality of the random
stuff that has been collected in the utils package. Idealy we shuld get rid
of this random addons. """
import unittest
from utils import html_cleaner
class HtmlTestCase(unittest.TestCase):
""" Unit testcase to verify the HTML cleanup class.
It should removed unwanted syling tags an more get rid of dangerous
JavaScript elements.
"""
known_html = (
('Fett!', 'Fett!'),
('Bad Link',
'Bad Link'),
('''
Hey Brad;
2) My host recently
added Webalizer and I am trying to find the best way to keep the program running
correctly and to deny outsiders the ability to look at it. I would prefer not to
give others access to my stats. I do web design and at any given time have
client demos in various stages of completion and other things I'd prefer not to
have the general public see popping up in my stats. Does Webalizer have a
password protection mode or anything?
''',
''
)
)
def test_html_cleaner(self):
"""Ugly HTML Code has been made tidy"""
cleaner = html_cleaner.HtmlCleaner()
for original, tidy in self.known_html:
self.assertEqual(cleaner.clean_html(original), tidy)
if __name__ == '__main__':
unittest.main()