Skip to content

Commit ce1e2ef

Browse files
t20Dante
andauthored
loosen version requirements for urllib3 (#143)
* Loosen requirements for urllib3 version * Update setup.py * fix: integration tests * fix: lint --------- Co-authored-by: Dante <{ID}+{username}@users.noreply.github.com>
1 parent 8ff3e8d commit ce1e2ef

7 files changed

Lines changed: 31 additions & 4 deletions

File tree

config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"state":"package_test"}

integration_tests/ads/test_ad_groups.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ def test_create_ad_group_success(self):
2525
name="SDK_INTEGRATION_TEST_ADGROUP",
2626
auto_targeting_enabled=False,
2727
bid_in_micro_currency=10000000,
28+
targeting_spec=dict(
29+
age_bucket=["35-44"],
30+
location=["US"],
31+
)
2832
)
2933

3034
assert ad_group
@@ -63,7 +67,10 @@ def test_update_success(self):
6367
)
6468

6569
new_name = "SDK_AD_GROUP_NEW_NAME"
66-
new_spec = {"gender": ["male"]}
70+
new_spec = {
71+
"age_bucket":["35-44"],
72+
"location": ["US"],
73+
}
6774

6875
ad_group.update_fields(
6976
name=new_name,
@@ -72,7 +79,7 @@ def test_update_success(self):
7279

7380
assert ad_group
7481
assert getattr(ad_group, "_name") == new_name
75-
assert str(getattr(ad_group,"_targeting_spec")) == str(new_spec)
82+
assert str(getattr(ad_group,"_targeting_spec")).lower() == str(new_spec).lower()
7683

7784
def test_update_fail_with_invalid_tracking_urls(self):
7885
"""
@@ -138,6 +145,10 @@ def test_get_list_with_campaign_ids_success(self):
138145
name="SDK_INTEGRATION_TEST_ADGROUP",
139146
auto_targeting_enabled=False,
140147
bid_in_micro_currency=10000000,
148+
targeting_spec=dict(
149+
age_bucket=["35-44"],
150+
location=["US"],
151+
)
141152
)
142153

143154
new_ad_groups = AdGroup.get_all(

integration_tests/ads/test_campaigns.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ def test_list_ad_groups(self):
186186
name="SDK_INTEGRATION_TEST_ADGROUP",
187187
auto_targeting_enabled=False,
188188
bid_in_micro_currency=10000000,
189+
targeting_spec=dict(
190+
age_bucket=["35-44"],
191+
location=["US"],
192+
)
189193
)
190194
)
191195

integration_tests/utils/ads_utils.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ def __init__(self, client=None):
144144
name="SDK_INTEGRATION_TEST_ADGROUP",
145145
auto_targeting_enabled=False,
146146
bid_in_micro_currency=10000000,
147+
targeting_spec=dict(
148+
age_bucket=["35-44"],
149+
location=["US"],
150+
)
147151
)
148152
self.ad_group_id = self.ad_group._id
149153

@@ -162,6 +166,10 @@ def get_default_params(self):
162166
name="SDK_INTEGRATION_TEST_ADGROUP",
163167
auto_targeting_enabled=False,
164168
bid_in_micro_currency=10000000,
169+
targeting_spec=dict(
170+
age_bucket=["35-44"],
171+
location=["US"],
172+
)
165173
)
166174

167175
def create_new_ad_group(self, **kwargs):

pinterest/ads/ad_groups.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,9 @@ def create(
317317
Returns:
318318
AdGroup: AdGroup Object
319319
"""
320+
if "targeting_spec" in kwargs:
321+
kwargs["targeting_spec"] = TargetingSpec(**kwargs["targeting_spec"])
322+
320323
response = cls._create(
321324
params={
322325
"ad_account_id": str(ad_account_id),

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Pinterest-Generated-Client==0.1.9
22
python-dateutil==2.8.2
33
six==1.16.0
4-
urllib3==1.26.12
4+
urllib3>=1.26.12
55
python-dotenv==0.20.0

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def _get_prod_version():
2121
_IS_TEST_BUILD = os.environ.get("IS_TEST_BUILD", 0)
2222

2323
REQUIRES = [
24-
"urllib3==1.26.12",
24+
"urllib3>=1.26.12",
2525
"python-dateutil",
2626
"python-dotenv==0.20.0",
2727
"six==1.16.0",

0 commit comments

Comments
 (0)