def test_categories(self): self.generate_entry("test1.txt") self.generate_entry("cat1/test_cat1.txt") self.generate_entry("cat2/test_cat2.txt") pycategories.cb_prepare(self.args) self.assertEquals( str(self.request.get_data()["categorylinks"]), "\n".join([ '<ul class="categorygroup">', '<li><a href="http://bl.og//index.html">/</a> (3)</li>', '<li><ul class="categorygroup">', '<li><a href="http://bl.og//cat1/index.html">cat1/</a> (1)</li>', '<li><a href="http://bl.og//cat2/index.html">cat2/</a> (1)</li>', '</ul></li>', '</ul>' ]))
def test_categories(self): self.generate_entry("test1.txt") self.generate_entry("cat1/test_cat1.txt") self.generate_entry("cat2/test_cat2.txt") pycategories.cb_prepare(self.args) self.assertEquals( str(self.request.get_data()["categorylinks"]), "\n".join( ['<ul class="categorygroup">', '<li><a href="http://bl.og//index.html">/</a> (3)</li>', '<li><ul class="categorygroup">', '<li><a href="http://bl.og//cat1/index.html">cat1/</a> (1)</li>', '<li><a href="http://bl.og//cat2/index.html">cat2/</a> (1)</li>', '</ul></li>', '</ul>']))
def test_no_categories(self): pycategories.cb_prepare(self.args) self.assertEquals( str(self.request.get_data()["categorylinks"]), "<ul class=\"categorygroup\">\n\n</ul>")
def test_cb_prepare(self): self.assert_("categorylinks" not in self.request.get_data()) pycategories.cb_prepare(self.args) self.assert_("categorylinks" in self.request.get_data())
def test_no_categories(self): pycategories.cb_prepare(self.args) self.assertEquals(str(self.request.get_data()["categorylinks"]), "<ul class=\"categorygroup\">\n\n</ul>")