Skip to content
Merged
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
7 changes: 2 additions & 5 deletions atlassian/confluence/cloud/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,8 @@ def __init__(self, url: str, *args, **kwargs):
# self._compatibility_method_mapping = {
# "old_method_name": "new_method_name"
# }

# Warn about V1 method usage
warnings.warn(
"V1 methods are deprecated in ConfluenceCloud. Use V2 methods instead.", DeprecationWarning, stacklevel=2
)
# V1 method names emit their own DeprecationWarning when they are
# called, so creating the client itself does not warn.

def __getattr__(self, name):
"""
Expand Down
9 changes: 9 additions & 0 deletions tests/test_confluence_v2_compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ def setUp(self):
password="password",
)

def test_init_does_not_warn(self):
"""Creating a client must not emit a DeprecationWarning by itself."""
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")

ConfluenceV2(url="https://example.atlassian.net/wiki", username="username", password="password")

self.assertEqual([str(warning.message) for warning in w if warning.category is DeprecationWarning], [])

def test_method_mapping_exists(self):
"""Test that compatibility method mapping exists."""
self.assertTrue(hasattr(self.confluence_v2, "_compatibility_method_mapping"))
Expand Down
Loading