Files
thrillwiki_django_no_react/shared/docs/memory-bank/testing/parks-test-migration-fixes.md
pacnpal d504d41de2 feat: complete monorepo structure with frontend and shared resources
- Add complete backend/ directory with full Django application
- Add frontend/ directory with Vite + TypeScript setup ready for Next.js
- Add comprehensive shared/ directory with:
  - Complete documentation and memory-bank archives
  - Media files and avatars (letters, park/ride images)
  - Deployment scripts and automation tools
  - Shared types and utilities
- Add architecture/ directory with migration guides
- Configure pnpm workspace for monorepo development
- Update .gitignore to exclude .django_tailwind_cli/ build artifacts
- Preserve all historical documentation in shared/docs/memory-bank/
- Set up proper structure for full-stack development with shared resources
2025-08-23 18:40:07 -04:00

2.3 KiB

Parks Tests Migration Fixes - Owner → Operator

Task Overview

Update parks tests to fix field mismatches from the Company.owner → Operator migration.

Issues Identified

1. test_models.py

  • Line 28: owner=self.operator should be operator=self.operator
  • Line 50: Correctly uses self.park.operator but creation is wrong

2. test_filters.py

  • Line 58: owner=cls.operator2 should be operator=cls.operator2
  • Line 206: Test method name test_company_filtering references old concept
  • Lines 206-222: Filter tests use has_owner which should be has_operator

3. test_search.py

  • No issues - creates parks without operators

Required Changes

Field Name Updates

  • Change all owner= to operator= in Park.objects.create()
  • Update test assertions from has_owner to has_operator
  • Update filter parameter from operator to match new field structure

Test Method Updates

  • Rename test_company_filtering to test_operator_filtering
  • Update comments and docstrings to reflect new terminology

Entity Relationship Rules Applied

  • Parks MUST have an Operator (required relationship)
  • Parks MAY have a PropertyOwner (optional, usually same as Operator)
  • Parks CANNOT directly reference Company entities

Files Updated

parks/tests/test_models.py

  • Fixed Line 28: Changed owner=self.operator to operator=self.operator

parks/tests/test_filters.py

  • Fixed Line 58: Changed owner=cls.operator2 to operator=cls.operator2
  • Fixed Line 193: Renamed test_company_filtering to test_operator_filtering
  • Fixed Lines 196-222: Updated filter tests to use has_operator instead of has_owner
  • Fixed Lines 196, 201: Changed .id to .pk for proper Django model access

parks/filters.py

  • Fixed Line 137: Changed has_owner to has_operator in filter logic

Test Results

  • All owner → operator migration issues resolved
  • Filter tests now pass
  • ⚠️ One unrelated test failure in ParkArea historical slug lookup (not migration-related)

Migration Status: COMPLETED

All parks tests have been successfully updated to work with the new operator field and Operator model structure. The entity relationship rules are now properly enforced in the test suite.