Pin the response shapes captured from a real server
Twice now a mock written from the upstream source passed while a real server disagreed — the system-log timestamps and the `/subscriptions/steps` shape — and `frequency_id` and several empty-string fields were wrong the same way. Reading the source harder was not going to find the next one. `tests/fixtures/*.json` hold the *shapes* of real responses: every key, with its JSON type, and no values at all. `real_shapes.rs` decodes each one and checks that a decode plus re-serialise loses no key, so a field the models silently drop now fails a test. It also refuses a fixture holding any real value, and refuses a fixture that no test reads. `seed_sample_data.rs` fills a disposable instance with one row of each kind and `capture_shapes.rs` captures the shapes back out with GET requests only, so the set can be refreshed when a divergence turns up. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Vendored
+114
@@ -0,0 +1,114 @@
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"address1": "",
|
||||
"address2": "",
|
||||
"archived_at": 0,
|
||||
"assigned_user_id": "",
|
||||
"balance": 0,
|
||||
"city": "",
|
||||
"classification": "",
|
||||
"client_hash": "",
|
||||
"contacts": [
|
||||
{
|
||||
"archived_at": 0,
|
||||
"can_sign": false,
|
||||
"cc_only": false,
|
||||
"contact_key": "",
|
||||
"created_at": 0,
|
||||
"custom_value1": "",
|
||||
"custom_value2": "",
|
||||
"custom_value3": "",
|
||||
"custom_value4": "",
|
||||
"email": "",
|
||||
"first_name": "",
|
||||
"id": "",
|
||||
"is_locked": false,
|
||||
"is_primary": false,
|
||||
"last_login": 0,
|
||||
"last_name": "",
|
||||
"link": "",
|
||||
"password": "",
|
||||
"phone": "",
|
||||
"send_email": false,
|
||||
"updated_at": 0
|
||||
}
|
||||
],
|
||||
"country_id": "",
|
||||
"created_at": 0,
|
||||
"credit_balance": 0,
|
||||
"custom_value1": "",
|
||||
"custom_value2": "",
|
||||
"custom_value3": "",
|
||||
"custom_value4": "",
|
||||
"display_name": "",
|
||||
"documents": [
|
||||
{
|
||||
"archived_at": 0,
|
||||
"assigned_user_id": "",
|
||||
"created_at": 0,
|
||||
"disk": "",
|
||||
"documentable_id": "",
|
||||
"documentable_type": "",
|
||||
"hash": "",
|
||||
"height": 0,
|
||||
"id": "",
|
||||
"is_default": false,
|
||||
"is_deleted": false,
|
||||
"is_public": false,
|
||||
"link": "",
|
||||
"name": "",
|
||||
"preview": "",
|
||||
"project_id": "",
|
||||
"size": 0,
|
||||
"type": "",
|
||||
"updated_at": 0,
|
||||
"url": "",
|
||||
"user_id": "",
|
||||
"vendor_id": "",
|
||||
"width": 0
|
||||
}
|
||||
],
|
||||
"e_invoice": {},
|
||||
"gateway_tokens": [],
|
||||
"group_settings_id": "",
|
||||
"has_valid_vat_number": false,
|
||||
"id": "",
|
||||
"id_number": "",
|
||||
"industry_id": "",
|
||||
"is_deleted": false,
|
||||
"is_tax_exempt": false,
|
||||
"last_login": 0,
|
||||
"locations": [],
|
||||
"name": "",
|
||||
"number": "",
|
||||
"paid_to_date": 0,
|
||||
"payment_balance": 0,
|
||||
"phone": "",
|
||||
"postal_code": "",
|
||||
"private_notes": "",
|
||||
"public_notes": "",
|
||||
"routing_id": "",
|
||||
"settings": {
|
||||
"currency_id": "",
|
||||
"entity": "",
|
||||
"industry_id": null,
|
||||
"size_id": null
|
||||
},
|
||||
"shipping_address1": "",
|
||||
"shipping_address2": "",
|
||||
"shipping_city": "",
|
||||
"shipping_country_id": "",
|
||||
"shipping_postal_code": "",
|
||||
"shipping_state": "",
|
||||
"size_id": "",
|
||||
"state": "",
|
||||
"tags": [],
|
||||
"tax_info": {},
|
||||
"updated_at": 0,
|
||||
"user_id": "",
|
||||
"vat_number": "",
|
||||
"website": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user