Use CaseUpdated
Pytest Fixtures Powered by MockHero
conftest.py
import os, requests, pytest
@pytest.fixture(scope="session")
def dataset():
return requests.post(
"https://api.mockhero.dev/api/v1/generate",
json={
"seed": 42,
"tables": [
{"name": "users", "count": 20, "fields": [
{"name": "id", "type": "uuid"},
{"name": "email", "type": "email"}
]},
{"name": "orders", "count": 80, "fields": [
{"name": "id", "type": "uuid"},
{"name": "user_id", "type": "ref", "ref": "users.id"},
{"name": "total", "type": "price"}
]}
]
},
headers={"x-api-key": os.environ["MOCKHERO_API_KEY"]}
).json()
def test_has_twenty_users(dataset):
assert len(dataset["users"]) == 20
Get Started
D
Founder of MockHero. Writes about synthetic test data, agent workflows, and database seeding with MockHero.
Start generating test data for free
500 records/day on the free tier. No credit card required.
Get Your API Key