Skip to content

Model factories for tests and seeding #30

Description

@eaguad1337

Problem

There is no factory pattern for generating model instances or realistic test data. Seeding is written by hand.

Proposal

Model factories:

  • Factory classes bound to models with a definition() returning attributes.
  • Faker integration for realistic values.
  • States (named attribute overrides), relationship helpers, and count() for batches.
  • Usable from both tests and seeders.
  • make:factory command + stub.

Scope

Factory base, discovery/registry, states, relationships, faker, command + stub.

Definition of Done

  • Implementation integrating with ORM seeding.
  • pytest covers single/batch creation, states, and relationships (suite green).
  • Docs page + nav entry.
  • Release notes entry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:dataData layer: ORM integration, pagination, factoriesenhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions