Files
plantillas-proyectos/backend/tests
AlexeerCT c812f5214c Add address handling for ClientProvider in business catalog creation
- Introduced a new helper function `_ensure_client_provider_address` to manage the assignment of addresses for ClientProvider instances.
- Refactored the `create_business_catalogs` function to utilize the new helper, ensuring that existing addresses are reused if available, preventing duplicate entries.
- This change enhances the integrity of address data during business catalog creation by ensuring proper address assignment based on existing records.
2026-03-24 12:42:19 -05:00
..
2026-03-24 12:33:21 -05:00
2026-03-24 12:33:21 -05:00

Backend test strategy (Anexo24)

Test suites

  • tests/e2e/: full business flow (catalogs -> import -> export -> balances/discharges).
  • tests/integration/: process API behavior and edge cases.
  • tests/unit/: critical algorithms only (no trivial CRUD tests).

Prerequisites

  • PostgreSQL test database available.
  • Environment variable:
    • TEST_DATABASE_URL=postgresql://user:pass@host:5432/db_name

Run commands

  • Fast subset (CI gate):
    • pytest -q tests/unit tests/integration
  • Full suite:
    • pytest -q tests
    • pytest tests -v -ra
    • pytest tests -v -ra -s
  • E2E only:
    • pytest -q tests/e2e

CI recommendations

  • Pull request gate:
    • Run unit + integration on every PR.
  • Nightly / main branch:
    • Run full suite including E2E.
  • Keep Celery eager mode for deterministic process endpoint tests:
    • task_always_eager=True
    • task_eager_propagates=True