Skip to content

Commit 4cbd005

Browse files
mundscursoragent
andauthored
chore: bump Pinterest-Generated-Client to 0.1.12 and update integration tests (#177)
Update integration tests to match new generated client behavior: - API errors now surface as ApiException instead of SdkException/AssertionError - Campaign creation requires is_campaign_budget_optimization=True for the test account Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 0748020 commit 4cbd005

5 files changed

Lines changed: 10 additions & 4 deletions

File tree

‎integration_tests/ads/test_ad_groups.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def test_update_fail_with_invalid_tracking_urls(self):
110110
tracking_urls=new_tracking_url
111111
)
112112

113-
with self.assertRaises((AssertionError, ApiException)):
113+
with self.assertRaises(ApiException):
114114
ad_group.update_fields(**update_argument)
115115

116116

‎integration_tests/ads/test_campaigns.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ def test_create_campaign_failure_without_budget(self):
4444
"""
4545
Verify a new Campaign response failure and catching exceptions
4646
"""
47+
# This ad account requires Campaign Budget Optimization, so CBO must be on;
48+
# with CBO on and no spend cap the API reports the missing-budget error 2384
49+
# (CBO campaigns need [lifetime_spend_cap and end_time] or daily_spend_cap).
4750
campaign_arguments = dict(
4851
client=self.test_client,
4952
ad_account_id=DEFAULT_AD_ACCOUNT_ID,

‎integration_tests/ads/test_keywords.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from integration_tests.config import DEFAULT_AD_ACCOUNT_ID
99

1010
from pinterest.ads.keywords import Keyword
11-
from pinterest.utils.sdk_exceptions import SdkException
1211

1312
from openapi_generated.pinterest_client.exceptions import ApiException
1413
from openapi_generated.pinterest_client.model.match_type_response import MatchTypeResponse
@@ -49,7 +48,7 @@ def test_create_fail_without_matchtype(self):
4948
value="string",
5049
)
5150

52-
with self.assertRaises((SdkException, ApiException)):
51+
with self.assertRaises(ApiException):
5352
Keyword.create(**keyword_arguments)
5453

5554

‎integration_tests/utils/ads_utils.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ def __init__(self, client=None):
109109
name="SDK Test Campaign",
110110
objective_type="AWARENESS",
111111
daily_spend_cap=10000000,
112+
# This ad account requires Campaign Budget Optimization (ad-group level
113+
# budgets are not allowed), so budgets must be set at the campaign level.
112114
is_campaign_budget_optimization=True,
113115
)
114116
self.campaign_id = self.campaign._id
@@ -126,6 +128,8 @@ def get_default_params(self):
126128
name="SDK Test Campaign",
127129
objective_type="AWARENESS",
128130
daily_spend_cap=10000000,
131+
# This ad account requires Campaign Budget Optimization (ad-group level
132+
# budgets are not allowed), so budgets must be set at the campaign level.
129133
is_campaign_budget_optimization=True,
130134
)
131135

‎requirements.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Pinterest-Generated-Client==0.1.11
1+
Pinterest-Generated-Client==0.1.12
22
python-dateutil==2.8.2
33
six==1.16.0
44
urllib3>=1.26.12

0 commit comments

Comments
 (0)