Repository navigation
fix(api): CircleMembers add/remove target /members/add|remove with access_value; list returns flat mapping - #67
Merged
Conversation
…; list returns flat mapping
CircleMembers.add()/remove() POSTed/DELETEed the bare /members path, which
werkzeug redirects to GET-only /members/ (405), and add() sent the payload
key "access" where the API expects "access_value". list() unwrapped a
"members" key that the API does not send (KeyError); the GET now targets
the canonical /members/ route and returns the flat {member_id:
access_value} mapping directly.
Fixes #42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #42. The circle members sub-resource did not conform to the Campus API routes (campus
weekly,campus/api/routes/circles.py):add()POSTed the bare/memberspath with payload key"access"— the trailing-slash redirect lands on GET-only/members/(405), and the API expects"access_value"remove()DELETEd/members— same 405; the API expectsDELETE /members/removelist()unwrappedresp.json()["members"], raisingKeyError— the API returns the flat{member_id: access_value}mapping as the bodyChanges
CircleMembersnow requests the endpoints the API actually exposes:list(): GET/api/v1/circles/<id>/members/(canonical route), returnsresp.json()directly (annotation corrected todict[str, int])add(): POST/api/v1/circles/<id>/members/addwith{"member_id": ..., "access_value": ...}remove(): DELETE/api/v1/circles/<id>/members/removewith{"member_id": ...}Updated
tests/unit/test_nested_resources.pyregression tests to the corrected endpoints and added coverage foradd/removerequest targets and payloads.Testing
pytest tests/unit/test_nested_resources.py: 17 passed