Skip to content

Add page render tests for Blog, Breads, Locations, Recipes, People, and Search apps #623

@vikram-2101

Description

@vikram-2101

Summary

Currently, only the HomePage model has test coverage (bakerydemo/base/tests/test_home_page.py).
The following apps have zero tests:

  • blogBlogIndexPage, BlogPage
  • breadsBreadsIndexPage, BreadPage
  • locationsLocationsIndexPage, LocationPage
  • recipesRecipeIndexPage, RecipePage
  • people — (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:

  1. The page renders with HTTP 200
  2. The correct template is used
  3. 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 template

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions