Skip to content

Commit 59767aa

Browse files
chore: update SDK to v0.10.2
1 parent 25d9d65 commit 59767aa

70 files changed

Lines changed: 19752 additions & 19751 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
project = "X API SDK"
2222
copyright = "2024, X Developer Platform"
2323
author = "X Developer Platform"
24-
release = "0.10.1"
25-
version = "0.10.1"
24+
release = "0.10.2"
25+
version = "0.10.2"
2626

2727
# -- General configuration ----------------------------------------------------
2828

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ build-backend = "hatchling.build"
1414

1515
[project]
1616
name = "xdk"
17-
version = "0.10.1"
17+
version = "0.10.2"
1818
description = "Python SDK for the X API"
1919
authors = [
2020
{name = "X Developer Platform", email = "devs@x.com"},

tests/account_activity/test_contracts.py

Lines changed: 195 additions & 195 deletions
Large diffs are not rendered by default.

tests/account_activity/test_structure.py

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -43,34 +43,33 @@ def setup_class(self):
4343
self.account_activity_client = getattr(self.client, "account_activity")
4444

4545

46-
def test_delete_subscription_exists(self):
47-
"""Test that delete_subscription method exists with correct signature."""
46+
def test_validate_subscription_exists(self):
47+
"""Test that validate_subscription method exists with correct signature."""
4848
# Check method exists
49-
method = getattr(AccountActivityClient, "delete_subscription", None)
49+
method = getattr(AccountActivityClient, "validate_subscription", None)
5050
assert (
5151
method is not None
52-
), f"Method delete_subscription does not exist on AccountActivityClient"
52+
), f"Method validate_subscription does not exist on AccountActivityClient"
5353
# Check method is callable
54-
assert callable(method), f"delete_subscription is not callable"
54+
assert callable(method), f"validate_subscription is not callable"
5555
# Check method signature
5656
sig = inspect.signature(method)
5757
params = list(sig.parameters.keys())
5858
# Should have 'self' as first parameter
5959
assert (
6060
len(params) >= 1
61-
), f"delete_subscription should have at least 'self' parameter"
61+
), f"validate_subscription should have at least 'self' parameter"
6262
assert (
6363
params[0] == "self"
6464
), f"First parameter should be 'self', got '{params[0]}'"
6565
# Check required parameters exist (excluding 'self')
6666
required_params = [
6767
"webhook_id",
68-
"user_id",
6968
]
7069
for required_param in required_params:
7170
assert (
7271
required_param in params
73-
), f"Required parameter '{required_param}' missing from delete_subscription"
72+
), f"Required parameter '{required_param}' missing from validate_subscription"
7473
# Check optional parameters have defaults (excluding 'self')
7574
optional_params = []
7675
for optional_param in optional_params:
@@ -81,41 +80,43 @@ def test_delete_subscription_exists(self):
8180
), f"Optional parameter '{optional_param}' should have a default value"
8281

8382

84-
def test_delete_subscription_return_annotation(self):
85-
"""Test that delete_subscription has proper return type annotation."""
86-
method = getattr(AccountActivityClient, "delete_subscription")
83+
def test_validate_subscription_return_annotation(self):
84+
"""Test that validate_subscription has proper return type annotation."""
85+
method = getattr(AccountActivityClient, "validate_subscription")
8786
sig = inspect.signature(method)
8887
# Check return annotation exists
8988
assert (
9089
sig.return_annotation is not inspect.Signature.empty
91-
), f"Method delete_subscription should have return type annotation"
90+
), f"Method validate_subscription should have return type annotation"
9291

9392

94-
def test_get_subscription_count_exists(self):
95-
"""Test that get_subscription_count method exists with correct signature."""
93+
def test_create_subscription_exists(self):
94+
"""Test that create_subscription method exists with correct signature."""
9695
# Check method exists
97-
method = getattr(AccountActivityClient, "get_subscription_count", None)
96+
method = getattr(AccountActivityClient, "create_subscription", None)
9897
assert (
9998
method is not None
100-
), f"Method get_subscription_count does not exist on AccountActivityClient"
99+
), f"Method create_subscription does not exist on AccountActivityClient"
101100
# Check method is callable
102-
assert callable(method), f"get_subscription_count is not callable"
101+
assert callable(method), f"create_subscription is not callable"
103102
# Check method signature
104103
sig = inspect.signature(method)
105104
params = list(sig.parameters.keys())
106105
# Should have 'self' as first parameter
107106
assert (
108107
len(params) >= 1
109-
), f"get_subscription_count should have at least 'self' parameter"
108+
), f"create_subscription should have at least 'self' parameter"
110109
assert (
111110
params[0] == "self"
112111
), f"First parameter should be 'self', got '{params[0]}'"
113112
# Check required parameters exist (excluding 'self')
114-
required_params = []
113+
required_params = [
114+
"webhook_id",
115+
]
115116
for required_param in required_params:
116117
assert (
117118
required_param in params
118-
), f"Required parameter '{required_param}' missing from get_subscription_count"
119+
), f"Required parameter '{required_param}' missing from create_subscription"
119120
# Check optional parameters have defaults (excluding 'self')
120121
optional_params = []
121122
for optional_param in optional_params:
@@ -126,14 +127,14 @@ def test_get_subscription_count_exists(self):
126127
), f"Optional parameter '{optional_param}' should have a default value"
127128

128129

129-
def test_get_subscription_count_return_annotation(self):
130-
"""Test that get_subscription_count has proper return type annotation."""
131-
method = getattr(AccountActivityClient, "get_subscription_count")
130+
def test_create_subscription_return_annotation(self):
131+
"""Test that create_subscription has proper return type annotation."""
132+
method = getattr(AccountActivityClient, "create_subscription")
132133
sig = inspect.signature(method)
133134
# Check return annotation exists
134135
assert (
135136
sig.return_annotation is not inspect.Signature.empty
136-
), f"Method get_subscription_count should have return type annotation"
137+
), f"Method create_subscription should have return type annotation"
137138

138139

139140
def test_get_subscriptions_exists(self):
@@ -183,33 +184,34 @@ def test_get_subscriptions_return_annotation(self):
183184
), f"Method get_subscriptions should have return type annotation"
184185

185186

186-
def test_validate_subscription_exists(self):
187-
"""Test that validate_subscription method exists with correct signature."""
187+
def test_delete_subscription_exists(self):
188+
"""Test that delete_subscription method exists with correct signature."""
188189
# Check method exists
189-
method = getattr(AccountActivityClient, "validate_subscription", None)
190+
method = getattr(AccountActivityClient, "delete_subscription", None)
190191
assert (
191192
method is not None
192-
), f"Method validate_subscription does not exist on AccountActivityClient"
193+
), f"Method delete_subscription does not exist on AccountActivityClient"
193194
# Check method is callable
194-
assert callable(method), f"validate_subscription is not callable"
195+
assert callable(method), f"delete_subscription is not callable"
195196
# Check method signature
196197
sig = inspect.signature(method)
197198
params = list(sig.parameters.keys())
198199
# Should have 'self' as first parameter
199200
assert (
200201
len(params) >= 1
201-
), f"validate_subscription should have at least 'self' parameter"
202+
), f"delete_subscription should have at least 'self' parameter"
202203
assert (
203204
params[0] == "self"
204205
), f"First parameter should be 'self', got '{params[0]}'"
205206
# Check required parameters exist (excluding 'self')
206207
required_params = [
207208
"webhook_id",
209+
"user_id",
208210
]
209211
for required_param in required_params:
210212
assert (
211213
required_param in params
212-
), f"Required parameter '{required_param}' missing from validate_subscription"
214+
), f"Required parameter '{required_param}' missing from delete_subscription"
213215
# Check optional parameters have defaults (excluding 'self')
214216
optional_params = []
215217
for optional_param in optional_params:
@@ -220,43 +222,41 @@ def test_validate_subscription_exists(self):
220222
), f"Optional parameter '{optional_param}' should have a default value"
221223

222224

223-
def test_validate_subscription_return_annotation(self):
224-
"""Test that validate_subscription has proper return type annotation."""
225-
method = getattr(AccountActivityClient, "validate_subscription")
225+
def test_delete_subscription_return_annotation(self):
226+
"""Test that delete_subscription has proper return type annotation."""
227+
method = getattr(AccountActivityClient, "delete_subscription")
226228
sig = inspect.signature(method)
227229
# Check return annotation exists
228230
assert (
229231
sig.return_annotation is not inspect.Signature.empty
230-
), f"Method validate_subscription should have return type annotation"
232+
), f"Method delete_subscription should have return type annotation"
231233

232234

233-
def test_create_subscription_exists(self):
234-
"""Test that create_subscription method exists with correct signature."""
235+
def test_get_subscription_count_exists(self):
236+
"""Test that get_subscription_count method exists with correct signature."""
235237
# Check method exists
236-
method = getattr(AccountActivityClient, "create_subscription", None)
238+
method = getattr(AccountActivityClient, "get_subscription_count", None)
237239
assert (
238240
method is not None
239-
), f"Method create_subscription does not exist on AccountActivityClient"
241+
), f"Method get_subscription_count does not exist on AccountActivityClient"
240242
# Check method is callable
241-
assert callable(method), f"create_subscription is not callable"
243+
assert callable(method), f"get_subscription_count is not callable"
242244
# Check method signature
243245
sig = inspect.signature(method)
244246
params = list(sig.parameters.keys())
245247
# Should have 'self' as first parameter
246248
assert (
247249
len(params) >= 1
248-
), f"create_subscription should have at least 'self' parameter"
250+
), f"get_subscription_count should have at least 'self' parameter"
249251
assert (
250252
params[0] == "self"
251253
), f"First parameter should be 'self', got '{params[0]}'"
252254
# Check required parameters exist (excluding 'self')
253-
required_params = [
254-
"webhook_id",
255-
]
255+
required_params = []
256256
for required_param in required_params:
257257
assert (
258258
required_param in params
259-
), f"Required parameter '{required_param}' missing from create_subscription"
259+
), f"Required parameter '{required_param}' missing from get_subscription_count"
260260
# Check optional parameters have defaults (excluding 'self')
261261
optional_params = []
262262
for optional_param in optional_params:
@@ -267,24 +267,24 @@ def test_create_subscription_exists(self):
267267
), f"Optional parameter '{optional_param}' should have a default value"
268268

269269

270-
def test_create_subscription_return_annotation(self):
271-
"""Test that create_subscription has proper return type annotation."""
272-
method = getattr(AccountActivityClient, "create_subscription")
270+
def test_get_subscription_count_return_annotation(self):
271+
"""Test that get_subscription_count has proper return type annotation."""
272+
method = getattr(AccountActivityClient, "get_subscription_count")
273273
sig = inspect.signature(method)
274274
# Check return annotation exists
275275
assert (
276276
sig.return_annotation is not inspect.Signature.empty
277-
), f"Method create_subscription should have return type annotation"
277+
), f"Method get_subscription_count should have return type annotation"
278278

279279

280280
def test_all_expected_methods_exist(self):
281281
"""Test that all expected methods exist on the client."""
282282
expected_methods = [
283-
"delete_subscription",
284-
"get_subscription_count",
285-
"get_subscriptions",
286283
"validate_subscription",
287284
"create_subscription",
285+
"get_subscriptions",
286+
"delete_subscription",
287+
"get_subscription_count",
288288
]
289289
for expected_method in expected_methods:
290290
assert hasattr(

tests/articles/test_contracts.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,11 @@ def test_article_create_draft_request_structure(self):
4848
# Mock the session to capture request details
4949
with patch.object(self.client, "session") as mock_session:
5050
mock_response = Mock()
51-
mock_response.status_code = 201
51+
mock_response.status_code = 200
5252
# Minimal spec-valid payload generated from the OpenAPI response schema
53-
mock_response.json.return_value = json.loads(r"""{}""")
53+
mock_response.json.return_value = json.loads(
54+
r"""{"code":1,"message":"test_value"}"""
55+
)
5456
mock_response.raise_for_status.return_value = None
5557
mock_response.headers = {"content-type": "application/json"}
5658
mock_session.post.return_value = mock_response
@@ -113,7 +115,7 @@ def test_article_create_draft_request_structure(self):
113115
# Set up streaming mock only for actual streaming operations
114116
if has_stream_config_param:
115117
mock_streaming_response = Mock()
116-
mock_streaming_response.status_code = 201
118+
mock_streaming_response.status_code = 200
117119
mock_streaming_response.raise_for_status.return_value = None
118120
# Make it a proper context manager
119121
mock_streaming_response.__enter__ = Mock(
@@ -242,9 +244,9 @@ def test_article_create_draft_response_structure(self):
242244
"""Test article_create_draft response structure validation."""
243245
with patch.object(self.client, "session") as mock_session:
244246
# Create mock response from the OpenAPI response schema (minimal valid payload)
245-
mock_response_data = json.loads(r"""{}""")
247+
mock_response_data = json.loads(r"""{"code":1,"message":"test_value"}""")
246248
mock_response = Mock()
247-
mock_response.status_code = 201
249+
mock_response.status_code = 200
248250
mock_response.json.return_value = mock_response_data
249251
mock_response.raise_for_status.return_value = None
250252
mock_response.headers = {"content-type": "application/json"}

0 commit comments

Comments
 (0)