Skip to content

Align the catalogue tests with the canonical cohort routes #347

Description

@alexeygrigorev

Goal

Unblock the Django release gate: since #320 the catalogue template emits the canonical cohort routes, but three catalogue tests still expect the legacy generic two-segment shape. The django job has been unable to run to completion on main since #320 landed (every run died earlier at the quality gate, fixed by #341), so these stale expectations surfaced only now, as the only remaining red gate.

Evidence

Main run 34189057638 (87fd3f4): quality, container, playwright and screenshots all pass; django fails with 2 failures + 1 error, all in courses/tests/test_course_list_ordering.py:

  • test_catalogue_has_one_family_card_for_multiple_cohorts: asserts the literal /courses/catalogue-course/2026, but the card renders /courses/catalogue-course/cohorts/2026.
  • test_featured_course_is_an_exact_homepage_catalog_cohort: expects href="/courses/de-zoomcamp/2026", page renders the /cohorts/ shape.
  • test_active_and_finished_cards_link_to_their_cohort_routes: the course_card_html helper (courses/tests/course_list_base.py) locates the card via reverse("course", ...) and fails with ValueError: substring not found.

Root cause: #320 renamed the catalogue template's edition URL from {% url 'course' %} to {% url 'cohort' %}. Per the frozen route map (_docs/compatibility/shared-curriculum-route-aliases.json, decided 2026-09-07, owner PM #320), /courses/<family>/cohorts/<identifier> (route name cohort) is canonical; the generic two-segment shape remains only as a legacy alias. The product is aligned with the spec; the three tests plus the two course_list_base.py helpers still assert the legacy shape.

Scope

Non-goals

  • No change to the route table, aliases, or any canonical route decision.
  • No broader test rewrite beyond the stale route expectations.

Acceptance criteria

  • uv run python manage.py test courses.tests.test_course_list_ordering --settings=website.settings.test passes.
  • The complete local Django suite passes (mirrors the CI django job).
  • make lint, make format-check, make typecheck stay green.
  • The next main CI run is gate-green end to end (quality, django, playwright, container).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0Must-have or release-blockingbugSomething isn't workingcoursesArea: coursestestingArea: testing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions