Test queries for list page
This commit is contained in:
parent
d83e3e0afe
commit
48c5aa0e56
1 changed files with 4 additions and 6 deletions
|
@ -52,16 +52,14 @@ class ListingPageTestCase(TestCase):
|
||||||
ContentPageFactory(parent=cls.page)
|
ContentPageFactory(parent=cls.page)
|
||||||
|
|
||||||
def test_accessible(self) -> None:
|
def test_accessible(self) -> None:
|
||||||
response = self.client.get(self.page.url)
|
with self.assertNumQueries(25):
|
||||||
|
response = self.client.get(self.page.url)
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
self.assertEqual(len(response.context["listing_pages"]), 2)
|
self.assertEqual(len(response.context["listing_pages"]), 2)
|
||||||
self.assertContains(response, self.page.reverse_subpage("feed"))
|
self.assertContains(response, self.page.reverse_subpage("feed"))
|
||||||
|
|
||||||
def test_feed_accessible(self) -> None:
|
def test_feed_accessible(self) -> None:
|
||||||
response = self.client.get(self.page.url + self.page.reverse_subpage("feed"))
|
with self.assertNumQueries(11):
|
||||||
|
response = self.client.get(self.page.url + self.page.reverse_subpage("feed"))
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
self.assertEqual(response["Content-Type"], "application/rss+xml; charset=utf-8")
|
self.assertEqual(response["Content-Type"], "application/rss+xml; charset=utf-8")
|
||||||
|
|
||||||
def test_queries(self) -> None:
|
|
||||||
with self.assertNumQueries(25):
|
|
||||||
self.client.get(self.page.url)
|
|
||||||
|
|
Loading…
Reference in a new issue