-
Notifications
You must be signed in to change notification settings - Fork 680
Add page render tests for Blog, Breads, Locations, Recipes, People, and Search apps #623
Copy link
Copy link
Open
Description
Summary
Currently, only the HomePage model has test coverage (bakerydemo/base/tests/test_home_page.py).
The following apps have zero tests:
blog—BlogIndexPage,BlogPagebreads—BreadsIndexPage,BreadPagelocations—LocationsIndexPage,LocationPagerecipes—RecipeIndexPage,RecipePagepeople— (People section, being added in People section of the site #567)search— search view
Problem
Without test coverage, regressions can go unnoticed during the ongoing redesign work.
Given that this project is moving towards a larger-scale demo (#566), a reliable test
suite becomes increasingly important.
Proposed Solution
Add a tests/ directory to each app (following the existing pattern in bakerydemo/base/tests/)
and write WagtailPageTestCase tests for each page type. At a minimum, each test should verify:
- The page renders with HTTP 200
- The correct template is used
- Key content from the page is present in the response
Example (following the existing HomePageRenderTest pattern):
# bakerydemo/blog/tests/test_blog_page.py
from wagtail.models import Page, Site
from wagtail.test.utils import WagtailPageTestCase
from bakerydemo.blog.models import BlogIndexPage, BlogPage
class BlogIndexPageRenderTest(WagtailPageTestCase):
def test_blog_index_renders(self):
... # assert status 200, correct templateReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels