fix(confluence): pass expand param correctly in get_page_space() - #1665
Open
mrcrysta1 wants to merge 1 commit into
Open
fix(confluence): pass expand param correctly in get_page_space()#1665mrcrysta1 wants to merge 1 commit into
mrcrysta1 wants to merge 1 commit into
Conversation
get_page_space() passed expand='space' as a keyword argument to self.get(), but AtlassianRestAPI.get() does not accept expand as a keyword — it expects it inside a params dict. This caused a TypeError when calling get_page_space() on Confluence Server v5.0.0+. Fix by building a params dict and passing it to self.get() directly, matching the pattern used by get_page_by_id() in the same file. Fixes atlassian-api#1663
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1665 +/- ##
==========================================
+ Coverage 59.74% 60.57% +0.83%
==========================================
Files 101 106 +5
Lines 16868 18047 +1179
Branches 1746 1842 +96
==========================================
+ Hits 10077 10932 +855
- Misses 6393 6655 +262
- Partials 398 460 +62 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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 #1663
get_page_space()in Confluence Server passesexpand="space"as a keyword argument toself.get(), butAtlassianRestAPI.get()does not acceptexpandas a keyword — it expects it inside aparamsdict. This causes aTypeError: AtlassianRestAPI.get() got an unexpected keyword argument 'expand'on Confluence Server v5.0.0+.Changes
atlassian/confluence/server/__init__.py: Updatedget_page_space()to build aparamsdict withexpandand pass it toself.get()directly, matching the pattern used byget_page_by_id()in the same file.tests/confluence/test_confluence_server.py: Updated existing test assertion and added 2 new tests for edge cases (page with no space, page with empty space object).Testing
All 156 Confluence Server tests pass:
Root Cause
The call chain is:
But
self.get()only acceptsparamsas a dict for query parameters. The fix short-circuitsget_content()and callsself.get()with the correctparams={"expand": "space"}pattern.This issue was introduced in the v5.0.0 Cloud/Server split.
AI assistance used: code exploration, test generation, and commit message drafting.