FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
twitter-python-ads-sdk/tests/test_client.py at master · xdevplatform/twitter-python-ads-sdk · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
xdevplatform
/
twitter-python-ads-sdk
Public
Notifications
You must be signed in to change notification settings
Fork
113
Star
202
Code
Issues
21
Pull requests
5
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
twitter-python-ads-sdk
/
tests
/
test_client.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
69 lines (55 loc) · 1.73 KB
Breadcrumbs
twitter-python-ads-sdk
/
tests
/
test_client.py
Copy path
File metadata and controls
69 lines (55 loc) · 1.73 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Copyright (C) 2015 Twitter, Inc.
import
responses
from
tests
.
support
import
with_resource
,
with_fixture
,
characters
from
twitter_ads
.
client
import
Client
from
twitter_ads
.
account
import
Account
from
twitter_ads
.
cursor
import
Cursor
from
twitter_ads
import
API_VERSION
@
responses
.
activate
def
test_accounts_with_no_id
():
responses
.
add
(
responses
.
GET
,
with_resource
(
'/'
+
API_VERSION
+
'/accounts'
),
body
=
with_fixture
(
'accounts_all'
),
content_type
=
'application/json'
)
client
=
Client
(
characters
(
40
),
characters
(
40
),
characters
(
40
),
characters
(
40
)
)
cursor
=
client
.
accounts
()
assert
cursor
is
not
None
assert
isinstance
(
cursor
,
Cursor
)
assert
cursor
.
count
==
5
@
responses
.
activate
def
test_accounts_with_id
():
responses
.
add
(
responses
.
GET
,
with_resource
(
'/'
+
API_VERSION
+
'/accounts/2iqph'
),
body
=
with_fixture
(
'accounts_load'
),
content_type
=
'application/json'
)
client
=
Client
(
characters
(
40
),
characters
(
40
),
characters
(
40
),
characters
(
40
)
)
account
=
client
.
accounts
(
'2iqph'
)
assert
account
is
not
None
assert
isinstance
(
account
,
Account
)
assert
account
.
id
==
'2iqph'
@
responses
.
activate
def
test_accounts_with_options
():
client
=
Client
(
characters
(
40
),
characters
(
40
),
characters
(
40
),
characters
(
40
),
options
=
{
'handle_rate_limit'
:
True
,
'retry_max'
:
1
,
'retry_delay'
:
3000
,
'retry_on_status'
: [
404
,
500
,
503
],
'timeout'
: (
1.0
,
3.0
)
}
)
assert
client
is
not
None
assert
isinstance
(
client
,
Client
)
assert
len
(
client
.
options
)
==
5
Back
|
FazBrowse Home
|
New Git URL