Skip to main content

Module fixtures

Module fixtures 

Source
Expand description

Test fixtures and factory helpers for reducing test boilerplate.

This module provides factory patterns for creating common test data with minimal setup code. All factories use the builder pattern for customization.

§Factory Types

§Example

use fastapi_core::fixtures::*;

// Create a GET request quickly
let req = RequestFactory::get("/users").build();

// Create an authenticated POST request
let req = RequestFactory::post("/items")
    .json(&item)
    .bearer_token("abc123")
    .build();

// Create test users
let user = UserFactory::new().email("test@example.com").build();

// Create valid/invalid JSON
let valid = JsonFactory::valid_object().build();
let invalid = JsonFactory::malformed().build();

Structs§

AuthFactory
Factory for creating authentication test data.
CommonFixtures
Pre-built common test data for quick access.
JsonArrayFactory
Factory for building JSON arrays.
JsonFactory
Factory for creating JSON test payloads.
JsonObjectFactory
Factory for building JSON objects.
JwtFactory
Factory for creating JWT-like tokens.
RequestFactory
Factory for creating test HTTP requests with minimal boilerplate.
ResponseFactory
Factory for creating test HTTP responses.
UserFactory
Factory for creating user test data.