Skip to content

Make metadata field tests more permissive#441

Merged
const-cloudinary merged 3 commits into
masterfrom
fix-metadata-tests-permissive
Jun 29, 2026
Merged

Make metadata field tests more permissive#441
const-cloudinary merged 3 commits into
masterfrom
fix-metadata-tests-permissive

Conversation

@const-cloudinary

Copy link
Copy Markdown
Member

Summary

Fixes two failing metadata field tests caused by server-side behavior changes, and makes the assertions more permissive against future additions.

  • test05_create_date_metadata_field was failing because the server now returns extra default keys in the restrictions object (hidden_ui, excluded_from_search) alongside the requested readonly_ui. The test did an exact-equality check.
  • test08_update_metadata_field was failing with 400 - Cannot have both mandatory and readonly fields set; the test sent mandatory: True together with restrictions: {readonly_ui: True}, which the server now rejects.

Changes

  • Add CldTestCase.assertObjectContainsSubset(actual, expected) — a recursive dict-subset assertion that allows actual to contain extra keys (no built-in covers the nested case).
  • Use it in assert_metadata_field, so added restriction defaults no longer break the test.
  • Drop the conflicting mandatory from the update test while keeping restrictions coverage (the unique behavior that test exercises).
  • Reuse the helper across the metadata reorder tests and a few uploader tests.

Test plan

  • python3 -m pytest test/test_metadata.py test/test_uploader.py --collect-only collects cleanly.
  • Affected tests are @skipUnless(api_secret) integration tests, exercised in CI where credentials are present.

🤖 Generated with Claude Code

const-cloudinary and others added 3 commits June 29, 2026 15:41
- Add CldTestCase.assertObjectContainsSubset for recursive dict-subset
  assertions, allowing the server to return extra keys.
- Use it in metadata field assertions so added restriction defaults
  (hidden_ui, excluded_from_search) no longer fail the test.
- Drop the conflicting mandatory+readonly combination in the update test
  (server rejects it) while keeping restrictions coverage.
- Reuse the helper across metadata reorder and uploader tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- Add Python 3.14 and Django 5.2 LTS / 6.0.
- Drop EOL Python 3.9 and Django 3.2.
- Pin django60 to Python 3.12+ (its minimum) in the matrix.
- Update classifiers in setup.py and pyproject.toml to match.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@const-cloudinary const-cloudinary merged commit ad4c390 into master Jun 29, 2026
28 checks passed
@const-cloudinary const-cloudinary deleted the fix-metadata-tests-permissive branch June 29, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant