Skip to content

Asset API: KeyError stragglers ('usage', 'product', 'hostname') #201

Description

@t-a-y-l-o-r

Summary

12 test failures with KeyError on three expected response/payload keys:

Key Count Likely cause
usage 6 Tests do response.data[\"usage\"] — either the field was removed from the serializer output or the usage fixture isn't seeding UsageBucket rows for the test's asset
product 4 Test stragglers using the old field name (renamed to model in commit 0012_rename_product_asset_model_and_more) — three were fixed today, four remain
hostname 2 Edge case — likely tests inspecting a response that omits hostname for assets with hostname IS NULL (after the recent nullable-hostname change)

Impact

12 test failures. Smaller than #199 (38) or #200 (32) but mechanical to clear in a single pass.

Suggested approach

Each key is its own grep — these don't share a single fix, but they're all the same shape ("test expected a key that isn't there"):

# usage  — find which AssetSerializer code path drops it
grep -rn '\"usage\"' blueflow/tests/ blueflow/views/asset.py

# product — should be \"model\"
grep -rn '\\[\"product\"\\]' blueflow/tests/

# hostname — likely the response shape change for NULL hostnames
grep -rn '\\[\"hostname\"\\]' blueflow/tests/

For \"hostname\": with the model now null=True, response.data[\"hostname\"] will be None for assets without a hostname, not \"\". Tests asserting assert response.data[\"hostname\"] == \"\" would now fail.

Notes

Cleanup tail from the productmodel rename and the recent hostname nullability change. Internal regression-prevention only.

Metadata

Metadata

Assignees

Type

Fields

No fields configured for Bug.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions