Exemplo n.º 1
0
    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>'
            ]))
Exemplo n.º 2
0
    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>']))
Exemplo n.º 3
0
 def test_no_categories(self):
     pycategories.cb_prepare(self.args)
     self.assertEquals(
         str(self.request.get_data()["categorylinks"]),
         "<ul class=\"categorygroup\">\n\n</ul>")
Exemplo n.º 4
0
 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())
Exemplo n.º 5
0
 def test_no_categories(self):
     pycategories.cb_prepare(self.args)
     self.assertEquals(str(self.request.get_data()["categorylinks"]),
                       "<ul class=\"categorygroup\">\n\n</ul>")
Exemplo n.º 6
0
 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())