class TestSearchIndexable(unittest.TestCase): def setUp(self): self.obj = SearchIndexable() def test_solarize_empty_index(self): self.obj.index = lambda: None assert_equal(self.obj.solarize(), None) def test_solarize_doc_without_text(self): self.obj.index = lambda: dict() assert_equal(self.obj.solarize(), dict(text='')) def test_solarize_strips_markdown(self): self.obj.index = lambda: dict(text='# Header') assert_equal(self.obj.solarize(), dict(text='Header')) def test_solarize_html_in_text(self): self.obj.index = lambda: dict(text='<script>a(1)</script>') assert_equal(self.obj.solarize(), dict(text='<script>a(1)</script>')) self.obj.index = lambda: dict(text='<script>a(1)</script>') assert_equal(self.obj.solarize(), dict(text='<script>a(1)</script>'))
def setUp(self): self.obj = SearchIndexable()