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
1 change: 1 addition & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"state":"package_test"}
15 changes: 13 additions & 2 deletions integration_tests/ads/test_ad_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ def test_create_ad_group_success(self):
name="SDK_INTEGRATION_TEST_ADGROUP",
auto_targeting_enabled=False,
bid_in_micro_currency=10000000,
targeting_spec=dict(
age_bucket=["35-44"],
location=["US"],
)
)

assert ad_group
Expand Down Expand Up @@ -63,7 +67,10 @@ def test_update_success(self):
)

new_name = "SDK_AD_GROUP_NEW_NAME"
new_spec = {"gender": ["male"]}
new_spec = {
"age_bucket":["35-44"],
"location": ["US"],
}

ad_group.update_fields(
name=new_name,
Expand All @@ -72,7 +79,7 @@ def test_update_success(self):

assert ad_group
assert getattr(ad_group, "_name") == new_name
assert str(getattr(ad_group,"_targeting_spec")) == str(new_spec)
assert str(getattr(ad_group,"_targeting_spec")).lower() == str(new_spec).lower()

def test_update_fail_with_invalid_tracking_urls(self):
"""
Expand Down Expand Up @@ -138,6 +145,10 @@ def test_get_list_with_campaign_ids_success(self):
name="SDK_INTEGRATION_TEST_ADGROUP",
auto_targeting_enabled=False,
bid_in_micro_currency=10000000,
targeting_spec=dict(
age_bucket=["35-44"],
location=["US"],
)
)

new_ad_groups = AdGroup.get_all(
Expand Down
4 changes: 4 additions & 0 deletions integration_tests/ads/test_campaigns.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ def test_list_ad_groups(self):
name="SDK_INTEGRATION_TEST_ADGROUP",
auto_targeting_enabled=False,
bid_in_micro_currency=10000000,
targeting_spec=dict(
age_bucket=["35-44"],
location=["US"],
)
)
)

Expand Down
8 changes: 8 additions & 0 deletions integration_tests/utils/ads_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ def __init__(self, client=None):
name="SDK_INTEGRATION_TEST_ADGROUP",
auto_targeting_enabled=False,
bid_in_micro_currency=10000000,
targeting_spec=dict(
age_bucket=["35-44"],
location=["US"],
)
)
self.ad_group_id = self.ad_group._id

Expand All @@ -162,6 +166,10 @@ def get_default_params(self):
name="SDK_INTEGRATION_TEST_ADGROUP",
auto_targeting_enabled=False,
bid_in_micro_currency=10000000,
targeting_spec=dict(
age_bucket=["35-44"],
location=["US"],
)
)

def create_new_ad_group(self, **kwargs):
Expand Down
3 changes: 3 additions & 0 deletions pinterest/ads/ad_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,9 @@ def create(
Returns:
AdGroup: AdGroup Object
"""
if "targeting_spec" in kwargs:
kwargs["targeting_spec"] = TargetingSpec(**kwargs["targeting_spec"])

response = cls._create(
params={
"ad_account_id": str(ad_account_id),
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Pinterest-Generated-Client==0.1.9
python-dateutil==2.8.2
six==1.16.0
urllib3==1.26.12
urllib3>=1.26.12
python-dotenv==0.20.0
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def _get_prod_version():
_IS_TEST_BUILD = os.environ.get("IS_TEST_BUILD", 0)

REQUIRES = [
"urllib3==1.26.12",
"urllib3>=1.26.12",
"python-dateutil",
"python-dotenv==0.20.0",
"six==1.16.0",
Expand Down
Loading