Example #1
0
    def test_display_order(self):
        """Verify the display_order is respected."""
        forum1 = ForumFactory(display_order=1)
        forum2 = ForumFactory(display_order=2)

        # forum1 should be listed first
        r = get(self.client, 'forums.forums')
        eq_(200, r.status_code)
        doc = pq(r.content)
        eq_(forum1.name, doc('ol.forums > li a').first().text())

        forum1.display_order = 3
        forum1.save()

        # forum2 should be listed first
        r = get(self.client, 'forums.forums')
        eq_(200, r.status_code)
        doc = pq(r.content)
        eq_(forum2.name, doc('ol.forums > li a').first().text())
Example #2
0
    def test_display_order(self):
        """Verify the display_order is respected."""
        forum1 = ForumFactory(display_order=1)
        forum2 = ForumFactory(display_order=2)

        # forum1 should be listed first
        r = get(self.client, "forums.forums")
        eq_(200, r.status_code)
        doc = pq(r.content)
        eq_(forum1.name, doc(".forums tr a").first().text())

        forum1.display_order = 3
        forum1.save()

        # forum2 should be listed first
        r = get(self.client, "forums.forums")
        eq_(200, r.status_code)
        doc = pq(r.content)
        eq_(forum2.name, doc(".forums tr a").first().text())
Example #3
0
    def test_is_listed(self):
        """Verify is_listed is respected."""
        forum1 = ForumFactory(is_listed=True)
        forum2 = ForumFactory(is_listed=True)

        # Both forums should be listed.
        r = get(self.client, 'forums.forums')
        eq_(200, r.status_code)
        doc = pq(r.content)
        eq_(2, len(doc('ol.forums > li')))

        forum1.is_listed = False
        forum1.save()

        # Only forum2 should be listed.
        r = get(self.client, 'forums.forums')
        eq_(200, r.status_code)
        doc = pq(r.content)
        eq_(1, len(doc('ol.forums > li')))
        eq_(forum2.name, doc('ol.forums > li a').text())
Example #4
0
    def test_is_listed(self):
        """Verify is_listed is respected."""
        forum1 = ForumFactory(is_listed=True)
        forum2 = ForumFactory(is_listed=True)

        # Both forums should be listed.
        r = get(self.client, "forums.forums")
        eq_(200, r.status_code)
        doc = pq(r.content)
        eq_(2, len(doc(".forums tr")))

        forum1.is_listed = False
        forum1.save()

        # Only forum2 should be listed.
        r = get(self.client, "forums.forums")
        eq_(200, r.status_code)
        doc = pq(r.content)
        eq_(1, len(doc(".forums tr")))
        eq_(forum2.name, doc(".forums tr a").text())