Skip to content

Commit

Permalink
Removing 'status' field from ad objects.
Browse files Browse the repository at this point in the history
Summary: 'status' needs to be passed as a parameter in create and update calls. It is not allowed as a field any longer.

Test Plan: Updated Integration tests per this changes. All tests pass
  • Loading branch information
Rituparna Mukherjee committed Oct 20, 2015
1 parent 4c28237 commit df6365a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
4 changes: 2 additions & 2 deletions facebookads/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def remote_delete(
):
return self.remote_update(
params={
self.Field.status: self.Status.deleted,
'status': self.Status.deleted,
},
batch=batch,
failure=failure,
Expand All @@ -75,7 +75,7 @@ def remote_archive(
):
return self.remote_update(
params={
self.Field.status: self.Status.archived,
'status': self.Status.archived,
},
batch=batch,
failure=failure,
Expand Down
11 changes: 4 additions & 7 deletions facebookads/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -1262,7 +1262,6 @@ class Field(object):
name = 'name'
objective = 'objective'
promoted_object = 'promoted_object'
status = 'status'

class BuyingType(object):
auction = 'AUCTION'
Expand Down Expand Up @@ -1321,7 +1320,6 @@ class Field(HasBidInfo, object):
rf_prediction_id = 'rf_prediction_id'
rtb_flag = 'rtb_flag'
start_time = 'start_time'
status = 'status'
targeting = 'targeting'
updated_time = 'updated_time'

Expand Down Expand Up @@ -1401,7 +1399,6 @@ class Field(HasBidInfo, object):
name = 'name'
redownload = 'redownload'
social_prefs = 'social_prefs'
status = 'status'
tracking_specs = 'tracking_specs'
updated_time = 'updated_time'
view_tags = 'view_tags'
Expand Down Expand Up @@ -2734,8 +2731,8 @@ class Field(object):
campaign_id = 'campaign_id'
campaign_name = 'campaign_name'
cost_per_action_type = 'cost_per_action_type'
cost_per_inline_link_click = 'cost_per_inline_link_click',
cost_per_inline_post_engagement = 'cost_per_inline_post_engagement',
cost_per_inline_link_click = 'cost_per_inline_link_click'
cost_per_inline_post_engagement = 'cost_per_inline_post_engagement'
cost_per_total_action = 'cost_per_total_action'
cost_per_unique_click = 'cost_per_unique_click'
cpm = 'cpm'
Expand All @@ -2746,8 +2743,8 @@ class Field(object):
frequency = 'frequency'
id = 'id'
impressions = 'impressions'
inline_link_clicks = 'inline_link_clicks',
inline_post_engagement = 'inline_post_engagement',
inline_link_clicks = 'inline_link_clicks'
inline_post_engagement = 'inline_post_engagement'
reach = 'reach'
relevance_score = 'relevance_score'
report_run_id = 'report_run_id'
Expand Down
8 changes: 4 additions & 4 deletions facebookads/test/integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def new_test_ad_set(self, campaign):
ad_set.update({
objects.AdSet.Field.name: 'AdSetTestCase %s' % self.TEST_ID,
objects.AdSet.Field.campaign_id: campaign_id,
objects.AdSet.Field.status: objects.AdSet.Status.paused,
'status': objects.AdSet.Status.paused,
objects.AdSet.Field.pacing_type: [
objects.AdSet.PacingType.standard,
],
Expand Down Expand Up @@ -169,7 +169,7 @@ def new_test_ad(self, ad_set):
objects.Ad.Field.creative: {
objects.Ad.Field.Creative.creative_id: creative_id,
},
objects.Ad.Field.status: objects.Ad.Status.paused,
'status': objects.Ad.Status.paused,
})

return ad
Expand Down Expand Up @@ -303,7 +303,7 @@ def test_can_select_api_version(self):

test_image_one[objects.AdImage.Field.filename] = image_file

assert test_image_one.remote_create(api_version="v2.4") is not None
assert test_image_one.remote_create(api_version="v2.5") is not None

test_image_two = objects.AdImage(
parent_id=self.TEST_ACCOUNT.get_id_assured(),
Expand All @@ -312,7 +312,7 @@ def test_can_select_api_version(self):
test_image_two[objects.AdImage.Field.filename] = image_file

try:
test_image_two.remote_create(api_version="v2.4")
test_image_two.remote_create(api_version="v2.5")
except fbexceptions.FacebookBadObjectError as e:
assert e is not None

Expand Down

0 comments on commit df6365a

Please sign in to comment.