Skip to content

Commit aed3497

Browse files
committed
Merge pull request #32 from twitterdev/account-load-bug
[bug] fix for incorrect return value in `Acccount.load()`
2 parents 631cb7f + f34e2e6 commit aed3497

34 files changed

+1486
-11
lines changed

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ pyyaml
22
requests-oauthlib
33
python-dateutil
44
sphinx
5+
responses
6+
mock

setup.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,11 @@ def get_version(version_tuple):
4040

4141
extra_opts = {
4242
'setup_requires': ['pytest-runner'],
43-
'tests_require': ['pytest']
43+
'tests_require': ['pytest', 'responses', 'mock']
4444
}
4545

4646
if sys.version_info[0] != 3:
4747
extra_opts['setup_requires'].append('flake8')
48-
else:
49-
extra_opts['tests_require'].append('mock')
5048

5149
setup(
5250
name='twitter-ads',

tests/.gitkeep

Whitespace-only changes.

tests/fixtures/accounts_all.json

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"request": {
3+
"params": {}
4+
},
5+
"data": [
6+
{
7+
"name": "Schuppe-Casper",
8+
"timezone": "America/Los_Angeles",
9+
"timezone_switch_at": "2014-11-17T08:00:00Z",
10+
"id": "2iqph",
11+
"created_at": "2015-03-04T10:50:42Z",
12+
"salt": "5ab2pizq7qxjjqrx3z67f4wbko61o7xs",
13+
"updated_at": "2015-04-11T05:20:08Z",
14+
"approval_status": "ACCEPTED",
15+
"deleted": false
16+
},
17+
{
18+
"name": "Schuppe-Casper",
19+
"timezone": "America/Los_Angeles",
20+
"timezone_switch_at": "2014-11-17T08:00:00Z",
21+
"id": "pz6ec",
22+
"created_at": "2015-05-29T00:52:16Z",
23+
"salt": "39ku32xvhdt0jax8thps2c70e2fv3yok",
24+
"updated_at": "2015-05-29T00:52:16Z",
25+
"approval_status": "ACCEPTED",
26+
"deleted": false
27+
},
28+
{
29+
"name": "Kozey-Farrell",
30+
"timezone": "America/Los_Angeles",
31+
"timezone_switch_at": "2014-11-17T08:00:00Z",
32+
"id": "j9ozo",
33+
"created_at": "2015-05-01T12:08:10Z",
34+
"salt": "winwfne3y6oyikl4tm84bj9r50waxj37",
35+
"updated_at": "2015-05-01T12:08:10Z",
36+
"approval_status": "ACCEPTED",
37+
"deleted": false
38+
},
39+
{
40+
"name": "Osinski, Quitzon and Hilll",
41+
"timezone": "America/Los_Angeles",
42+
"timezone_switch_at": "2014-11-17T08:00:00Z",
43+
"id": "9ttgd",
44+
"created_at": "2015-06-24T18:51:20Z",
45+
"salt": "tj9hmt5xylm5zztrq05w7hwh4mkpkg5r",
46+
"updated_at": "2015-06-26T06:13:24Z",
47+
"approval_status": "ACCEPTED",
48+
"deleted": false
49+
},
50+
{
51+
"name": "Jakubowski-Aufderhar",
52+
"timezone": "America/Los_Angeles",
53+
"timezone_switch_at": "2013-05-22T07:00:00Z",
54+
"id": "47d0v",
55+
"created_at": "2015-05-28T05:42:03Z",
56+
"salt": "1ms1mq1nww7zl7169865gwqt89s9127m",
57+
"updated_at": "2015-05-28T05:42:03Z",
58+
"approval_status": "ACCEPTED",
59+
"deleted": false
60+
}
61+
],
62+
"data_type": "account",
63+
"total_count": 5,
64+
"next_cursor": null
65+
}

tests/fixtures/accounts_features.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"data_type": "features",
3+
"data": [
4+
"CPI_CHARGING",
5+
"EVENT_TARGETING",
6+
"INSTALLED_APP_CATEGORY_TARGETING",
7+
"MOBILE_CONVERSION_TRANSACTION_VALUE",
8+
"OPTIMIZED_ACTION_BIDDING",
9+
"OPTIMIZED_WEBSITE_CONVERSIONS",
10+
"VIDEO_VIEWS_OBJECTIVE",
11+
"VIDEO_APP_DOWNLOAD_CARD"
12+
],
13+
"request": {
14+
"params": {
15+
"account_id": "2iqph"
16+
}
17+
}
18+
}

tests/fixtures/accounts_load.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"data_type": "account",
3+
"data": {
4+
"name": "Schuppe-Casper",
5+
"timezone": "America/Los_Angeles",
6+
"timezone_switch_at": "2014-11-17T08:00:00Z",
7+
"id": "2iqph",
8+
"created_at": "2015-03-04T10:50:42Z",
9+
"salt": "5ab2pizq7qxjjqrx3z67f4wbko61o7xs",
10+
"updated_at": "2015-04-11T05:20:08Z",
11+
"approval_status": "ACCEPTED",
12+
"deleted": false
13+
},
14+
"request": {
15+
"params": {
16+
"account_id": "2iqph"
17+
}
18+
}
19+
}

tests/fixtures/app_lists_all.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"request" : {
3+
"params" : {
4+
"account_id" : "2iqph"
5+
}
6+
},
7+
"data_type" : "app_list",
8+
"data" : [
9+
{
10+
"name" : "Some test app list",
11+
"id" : "abc2"
12+
},
13+
{
14+
"name" : "Yet another app list",
15+
"id" : "wdpr"
16+
},
17+
{
18+
"name" : "The best app list yet",
19+
"id" : "wdps"
20+
}
21+
]
22+
}

tests/fixtures/app_lists_load.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"data_type" : "app_list",
3+
"data" : {
4+
"apps" : [
5+
{
6+
"os_type" : "Android",
7+
"app_store_identifier" : "com.supercell.clashofclans"
8+
},
9+
{
10+
"app_store_identifier" : "com.functionx.viggle",
11+
"os_type" : "Android"
12+
},
13+
{
14+
"app_store_identifier" : "io.fabric.samples.cannonball",
15+
"os_type" : "Android"
16+
},
17+
{
18+
"os_type" : "Android",
19+
"app_store_identifier" : "com.hoteltonight.android.prod"
20+
}
21+
],
22+
"name" : "Some test app list",
23+
"id" : "abc2"
24+
},
25+
"request" : {
26+
"params" : {
27+
"account_id" : "2iqph",
28+
"app_list_id" : "abc2"
29+
}
30+
}
31+
}

tests/fixtures/campaigns_all.json

Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
{
2+
"request": {
3+
"params": {
4+
"account_id": "2iqph"
5+
}
6+
},
7+
"data": [
8+
{
9+
"name": "Intelligent Granite Computer",
10+
"start_time": "2015-08-12T20:26:23Z",
11+
"reasons_not_servable": [],
12+
"servable": true,
13+
"daily_budget_amount_local_micro": 1000000,
14+
"end_time": null,
15+
"funding_instrument_id": "5aa0p",
16+
"standard_delivery": true,
17+
"total_budget_amount_local_micro": null,
18+
"id": "2wap7",
19+
"paused": false,
20+
"account_id": "2iqph",
21+
"currency": "USD",
22+
"created_at": "2015-08-12T20:26:24Z",
23+
"updated_at": "2015-08-12T20:26:24Z",
24+
"deleted": false
25+
},
26+
{
27+
"name": "Awesome Wooden Table",
28+
"start_time": "2015-08-12T20:17:19Z",
29+
"reasons_not_servable": [
30+
"EXPIRED"
31+
],
32+
"servable": false,
33+
"daily_budget_amount_local_micro": 1000000,
34+
"end_time": "2015-08-14T20:17:19Z",
35+
"funding_instrument_id": "5aa0p",
36+
"standard_delivery": true,
37+
"total_budget_amount_local_micro": null,
38+
"id": "2wamv",
39+
"paused": true,
40+
"account_id": "2iqph",
41+
"currency": "USD",
42+
"created_at": "2015-08-12T20:17:39Z",
43+
"updated_at": "2015-08-12T20:18:21Z",
44+
"deleted": false
45+
},
46+
{
47+
"name": "Fantastic Concrete Car",
48+
"start_time": "2015-08-12T19:56:08Z",
49+
"reasons_not_servable": [
50+
"EXPIRED",
51+
"FUNDING_PROBLEM"
52+
],
53+
"servable": false,
54+
"daily_budget_amount_local_micro": 1000000,
55+
"end_time": null,
56+
"funding_instrument_id": "7cdql",
57+
"standard_delivery": true,
58+
"total_budget_amount_local_micro": null,
59+
"id": "2wai9",
60+
"paused": true,
61+
"account_id": "2iqph",
62+
"currency": "USD",
63+
"created_at": "2015-08-12T19:56:10Z",
64+
"updated_at": "2015-08-12T19:56:10Z",
65+
"deleted": false
66+
},
67+
{
68+
"name": "Small Concrete Hat",
69+
"start_time": "2015-06-29T22:00:00Z",
70+
"reasons_not_servable": [
71+
"PAUSED_BY_ADVERTISER"
72+
],
73+
"servable": false,
74+
"daily_budget_amount_local_micro": 1000000,
75+
"end_time": null,
76+
"funding_instrument_id": "5aa0p",
77+
"standard_delivery": true,
78+
"total_budget_amount_local_micro": 1000000,
79+
"id": "2of1n",
80+
"paused": true,
81+
"account_id": "2iqph",
82+
"currency": "USD",
83+
"created_at": "2015-06-29T22:24:17Z",
84+
"updated_at": "2015-08-12T18:58:56Z",
85+
"deleted": false
86+
},
87+
{
88+
"name": "Rustic Rubber Pants",
89+
"start_time": "2015-08-12T18:09:27Z",
90+
"reasons_not_servable": [
91+
"EXPIRED",
92+
"FUNDING_PROBLEM"
93+
],
94+
"servable": false,
95+
"daily_budget_amount_local_micro": 1000000,
96+
"end_time": null,
97+
"funding_instrument_id": "7cdql",
98+
"standard_delivery": true,
99+
"total_budget_amount_local_micro": null,
100+
"id": "2w9n1",
101+
"paused": true,
102+
"account_id": "2iqph",
103+
"currency": "USD",
104+
"created_at": "2015-08-12T18:09:28Z",
105+
"updated_at": "2015-08-12T18:09:28Z",
106+
"deleted": false
107+
},
108+
{
109+
"name": "Incredible Wooden Car",
110+
"start_time": "2015-08-10T21:58:00Z",
111+
"reasons_not_servable": [
112+
"PAUSED_BY_ADVERTISER"
113+
],
114+
"servable": false,
115+
"daily_budget_amount_local_micro": 1000000,
116+
"end_time": null,
117+
"funding_instrument_id": "5aa0p",
118+
"standard_delivery": true,
119+
"total_budget_amount_local_micro": 1000000,
120+
"id": "2vuug",
121+
"paused": true,
122+
"account_id": "2iqph",
123+
"currency": "USD",
124+
"created_at": "2015-08-10T21:58:39Z",
125+
"updated_at": "2015-08-10T21:59:43Z",
126+
"deleted": false
127+
},
128+
{
129+
"name": "Gorgeous Cotton Computer",
130+
"start_time": "2015-08-10T21:06:00Z",
131+
"reasons_not_servable": [],
132+
"servable": true,
133+
"daily_budget_amount_local_micro": 1000000,
134+
"end_time": null,
135+
"funding_instrument_id": "5aa0p",
136+
"standard_delivery": true,
137+
"total_budget_amount_local_micro": null,
138+
"id": "2vuj3",
139+
"paused": false,
140+
"account_id": "2iqph",
141+
"currency": "USD",
142+
"created_at": "2015-08-10T21:06:04Z",
143+
"updated_at": "2015-08-10T21:06:04Z",
144+
"deleted": false
145+
},
146+
{
147+
"name": "Sleek Rubber Car",
148+
"start_time": "2015-08-06T06:53:00Z",
149+
"reasons_not_servable": [],
150+
"servable": true,
151+
"daily_budget_amount_local_micro": 10000,
152+
"end_time": null,
153+
"funding_instrument_id": "5aa0p",
154+
"standard_delivery": true,
155+
"total_budget_amount_local_micro": 10000,
156+
"id": "2v3c4",
157+
"paused": false,
158+
"account_id": "2iqph",
159+
"currency": "USD",
160+
"created_at": "2015-08-06T06:54:13Z",
161+
"updated_at": "2015-08-06T06:54:13Z",
162+
"deleted": false
163+
},
164+
{
165+
"name": "Practical Plastic Computer",
166+
"start_time": "2015-08-04T23:20:10Z",
167+
"reasons_not_servable": [
168+
"INCOMPLETE"
169+
],
170+
"servable": false,
171+
"daily_budget_amount_local_micro": 100000000,
172+
"end_time": null,
173+
"funding_instrument_id": "5aa0p",
174+
"standard_delivery": true,
175+
"total_budget_amount_local_micro": 100000000,
176+
"id": "2uubq",
177+
"paused": false,
178+
"account_id": "2iqph",
179+
"currency": "USD",
180+
"created_at": "2015-08-04T23:20:11Z",
181+
"updated_at": "2015-08-04T23:20:11Z",
182+
"deleted": false
183+
},
184+
{
185+
"name": "Ergonomic Rubber Car",
186+
"start_time": "2015-07-29T23:04:00Z",
187+
"reasons_not_servable": [
188+
"PAUSED_BY_ADVERTISER"
189+
],
190+
"servable": false,
191+
"daily_budget_amount_local_micro": 1000000,
192+
"end_time": null,
193+
"funding_instrument_id": "5aa0p",
194+
"standard_delivery": true,
195+
"total_budget_amount_local_micro": null,
196+
"id": "2ttv3",
197+
"paused": true,
198+
"account_id": "2iqph",
199+
"currency": "USD",
200+
"created_at": "2015-07-29T23:05:56Z",
201+
"updated_at": "2015-07-31T18:01:26Z",
202+
"deleted": false
203+
}
204+
],
205+
"data_type": "campaign",
206+
"total_count": 10,
207+
"next_cursor": null
208+
}

0 commit comments

Comments
 (0)