Skip to content

Add comprehensive integration test against live Flickr API#149

Merged
beaufour merged 7 commits into
masterfrom
add-tests
Jan 24, 2026
Merged

Add comprehensive integration test against live Flickr API#149
beaufour merged 7 commits into
masterfrom
add-tests

Conversation

@beaufour

Copy link
Copy Markdown
Collaborator

Summary

  • Adds integration test covering 126 API methods against live Flickr API
  • Fixes OAuth signature calculation bug in upload.py for multipart file uploads
  • Includes interactive OAuth flow for obtaining tokens with proper permissions
  • Documents Places API as known Flickr backend issue (not a library bug)

Test Coverage

  • Read-only tests: Photo, Person, Gallery, Photoset, Group, Tag, Activity, Camera, License, Prefs, Reflection APIs
  • Write tests: Upload, photo metadata editing, tags, favorites, comments (with cleanup)
  • 3 tests skipped: Places API (broken on Flickr's end)

Test plan

  • All 126 tests pass against live Flickr API
  • Write tests properly clean up (delete uploaded photos)
  • OAuth flow tested with read, write, and delete permissions

🤖 Generated with Claude Code

@beaufour beaufour changed the base branch from master to extend-testing January 24, 2026 19:13
beaufour and others added 6 commits January 24, 2026 14:17
- Group.search: Fix duplicate 'id' argument error (API returns both
  'id' and 'nsid'), handle empty results with _check_list, make token
  parameter optional
- Place.getPlaceTypes: API returns 'id' not 'place_type_id'

Found via integration testing against live Flickr API.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Person.getGalleries: Wrap gallery dicts in Gallery objects
- Photo.getGalleries: Fix iteration bug (was iterating empty list),
  wrap dicts in Gallery objects, fix primary_photo type (Photo not Gallery)
- _extract_photo_list: Handle empty results, filter None values from
  info dict to prevent int() conversion errors

Found via integration testing against live Flickr API.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fixed format_dict() to convert integers properly (bytes(0) gives b''
  not b'0', so use str(v).encode('utf8') instead)
- Rewrote post() to manually calculate OAuth signature for multipart
  uploads, as requests-oauthlib doesn't handle Flickr's specific
  requirement that form parameters (but not file content) be included
  in the signature

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Tests 109 read-only API methods against the live Flickr API including:
- Basic API tests (test.echo, licenses, cameras, pandas, etc.)
- Object discovery (photos, persons, groups, places, tags)
- Photo operations (info, sizes, exif, context, download/save)
- Person operations (info, photos, photosets, galleries, contacts)
- Group operations (info, photos, members, topics)
- Photoset and Gallery operations
- Places and Tags operations
- Authenticated operations (prefs, activity, contacts, favorites)

Also includes write test infrastructure (--write-tests flag) for testing
upload, modify, and delete operations when a write-capable OAuth token
is available.

Usage:
  python integration_test.py --config ~/.flickr_api
  python integration_test.py --config ~/.flickr_api --write-tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add interactive OAuth flow (--auth flag) to get tokens with proper permissions
- Request 'delete' permission for write tests (includes write + delete)
- Fix favorites tests to use discovery photo (can't favorite own photos)
- Update default config paths to ~/.flickr_api_key and ~/.flickr_api_token
- Add --token-file option to specify token location

All 126 tests now pass (3 skipped for Places API returning empty).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Updated integration_test.py docstring to note that the Places API
returning empty results is a known Flickr backend issue, not a library
bug. Added reference to Flickr Help forum thread.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Base automatically changed from extend-testing to master January 24, 2026 19:21
Relocate integration_test.py and Test.png to integration_tests/
directory for better organization. Update test image path to be
relative to script location and document integration testing in
CLAUDE.md.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@beaufour beaufour merged commit 0897f95 into master Jan 24, 2026
@beaufour beaufour deleted the add-tests branch January 24, 2026 19:24
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