Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion atlassian/confluence/cloud/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ def get_page_by_id(
params["body-format"] = body_format

if not get_body:
params["body-format"] = "none"
# "none" is not a valid body-format and Confluence answers 400.
# Leaving body-format out returns the page without a body.
params.pop("body-format", None)

if expand:
params["expand"] = ",".join(expand)
Expand Down
10 changes: 9 additions & 1 deletion tests/test_confluence_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,17 @@ def test_get_page_by_id_without_body(self, mock_get):
response = self.confluence_v2.get_page_by_id("123", get_body=False)

# Assertions
mock_get.assert_called_once_with("api/v2/pages/123", params={"body-format": "none"})
mock_get.assert_called_once_with("api/v2/pages/123", params={})
self.assertEqual(response, mock_response)

@patch("atlassian.confluence.cloud.ConfluenceCloud.get")
def test_get_page_by_id_without_body_ignores_body_format(self, mock_get):
mock_get.return_value = {"id": "123", "title": "Test Page"}

self.confluence_v2.get_page_by_id("123", body_format="storage", get_body=False)

mock_get.assert_called_once_with("api/v2/pages/123", params={})

@patch("atlassian.confluence.cloud.ConfluenceCloud.get")
def test_get_page_versions(self, mock_get):
mock_response = {"results": [{"number": 2}]}
Expand Down
Loading