diff --git a/atlassian/confluence/cloud/__init__.py b/atlassian/confluence/cloud/__init__.py index aa8c78922..24ad4b6a0 100644 --- a/atlassian/confluence/cloud/__init__.py +++ b/atlassian/confluence/cloud/__init__.py @@ -213,11 +213,11 @@ def delete_content(self, content_id, **kwargs): def get_content_children(self, content_id, **kwargs): """Get child content.""" - return self.get(f"rest/api/content/{content_id}/children", **kwargs) + return self.get(f"rest/api/content/{content_id}/child", **kwargs) def get_content_descendants(self, content_id, **kwargs): """Get descendant content.""" - return self.get(f"rest/api/content/{content_id}/descendants", **kwargs) + return self.get(f"rest/api/content/{content_id}/descendant", **kwargs) def get_child_pages(self, content_id, **kwargs): """Get child pages of a content item.""" diff --git a/tests/confluence/test_confluence_cloud.py b/tests/confluence/test_confluence_cloud.py index ce600496e..da9ef56ae 100644 --- a/tests/confluence/test_confluence_cloud.py +++ b/tests/confluence/test_confluence_cloud.py @@ -550,7 +550,7 @@ def test_get_content_children(self, mock_get, confluence_cloud): """Test get_content_children method.""" mock_get.return_value = {"results": [{"id": "789", "title": "Child Page"}]} result = confluence_cloud.get_content_children("123") - mock_get.assert_called_once_with("rest/api/content/123/children", **{}) + mock_get.assert_called_once_with("rest/api/content/123/child", **{}) assert result == {"results": [{"id": "789", "title": "Child Page"}]} @patch.object(ConfluenceCloud, "get") @@ -558,9 +558,27 @@ def test_get_content_descendants(self, mock_get, confluence_cloud): """Test get_content_descendants method.""" mock_get.return_value = {"results": [{"id": "999", "title": "Descendant Page"}]} result = confluence_cloud.get_content_descendants("123") - mock_get.assert_called_once_with("rest/api/content/123/descendants", **{}) + mock_get.assert_called_once_with("rest/api/content/123/descendant", **{}) assert result == {"results": [{"id": "999", "title": "Descendant Page"}]} + @pytest.mark.parametrize( + "method, path", + [ + ("get_content_children", "child"), + ("get_content_descendants", "descendant"), + ], + ) + def test_get_content_children_and_descendants_request_wiki_content_endpoints(self, confluence_cloud, method, path): + response = Response() + response.status_code = 200 + response._content = b'{"page": {"results": [{"id": "789"}]}}' + + with patch.object(confluence_cloud._session, "request", return_value=response) as mock_request: + assert getattr(confluence_cloud, method)("123") == {"page": {"results": [{"id": "789"}]}} + + url = mock_request.call_args.kwargs["url"] + assert url == f"https://test.atlassian.net/wiki/rest/api/content/123/{path}" + @patch.object(ConfluenceCloud, "get") def test_get_content_ancestors(self, mock_get, confluence_cloud): """Test get_content_ancestors method."""