recordfixtures

command
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2026 License: MIT Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Command recordfixtures re-records testdata/fixtures from a live Payload instance.

go run ./tools/recordfixtures -base http://localhost:3900 -key <API-KEY> -out testdata/fixtures
make fixtures            # the same thing, from PAY_TEST_BASE_URL / PAY_TEST_API_KEY

Why a tool and not a shell script of curl calls:

  • Every recording goes through internal/payload's real client, so a fixture is by construction the bytes the CLI would actually have received — including the Accept-Language header, the retry policy and the api_path resolution. A fixture recorded by curl can silently differ from what the program sees.
  • Every body is passed through internal/redact before it touches the disk. A Payload project with useAPIKey returns the API key in plaintext from GET /{auth}/me (§7.8.3), so "record the response" and "commit the response" are not the same operation, and the difference must not be a human's discipline.
  • Recording the ERROR fixtures requires deliberately provoking six specific failures. Their exact bodies are §11.2's whole subject, and they are exactly the thing nobody re-derives by hand a year later.

The tool is idempotent: it rewrites every fixture it can record and leaves the rest alone, so `git diff testdata/fixtures` is the answer to "has Payload changed under us".

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL