# paperdoorknob: Print glowfic
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, version 3.
import unittest
from bs4 import BeautifulSoup
from domfilter import ApplyDOMFilters
class TestDOMFilters(unittest.TestCase):
def setUp(self) -> None:
self._html = BeautifulSoup(b'''
This is the edit box
This is glowfic
''', 'html.parser')
def testStripFooters(self) -> None:
ApplyDOMFilters("NoFooter", self._html)
self.assertEqual(list(self._html.stripped_strings),
["This is the edit box", "This is glowfic"])
def testStripEditBoxes(self) -> None:
ApplyDOMFilters("NoEdit", self._html)
self.assertEqual(list(self._html.stripped_strings),
["This is glowfic", "This is the footer"])
def testStripFootersAndEditBoxes(self) -> None:
ApplyDOMFilters("NoEdit,NoFooter", self._html)
self.assertEqual(list(self._html.stripped_strings),
["This is glowfic"])
if __name__ == '__main__':
unittest.main()