Skip to content

Commit b0c0a75

Browse files
zippolyteDavid Bouchare
authored andcommitted
Add _return_raw_response to api module (DataDog#461)
1 parent 1a6f111 commit b0c0a75

File tree

2 files changed

+40
-3
lines changed

2 files changed

+40
-3
lines changed

datadog/api/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
_max_retries = 3
1717
_backoff_period = 300
1818
_mute = True
19+
_return_raw_response = False
1920

2021
# Resources
2122
from datadog.api.comments import Comment

tests/unit/api/test_api.py

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,42 @@
4343

4444
class TestInitialization(DatadogAPINoInitialization):
4545

46+
def test_default_settings_set(self):
47+
"""
48+
Test all the default setting are properly set before calling initialize
49+
"""
50+
from datadog.api import (
51+
_api_key,
52+
_application_key,
53+
_api_version,
54+
_api_host,
55+
_host_name,
56+
_hostname_from_config,
57+
_cacert,
58+
_proxies,
59+
_timeout,
60+
_max_timeouts,
61+
_max_retries,
62+
_backoff_period,
63+
_mute,
64+
_return_raw_response,
65+
)
66+
67+
assert _api_key is None
68+
assert _application_key is None
69+
assert _api_version == 'v1'
70+
assert _api_host is None
71+
assert _host_name is None
72+
assert _hostname_from_config is True
73+
assert _cacert is True
74+
assert _proxies is None
75+
assert _timeout == 60
76+
assert _max_timeouts == 3
77+
assert _max_retries == 3
78+
assert _backoff_period == 300
79+
assert _mute is True
80+
assert _return_raw_response is False
81+
4682
def test_no_initialization_fails(self):
4783
"""
4884
Raise ApiNotInitialized exception when `initialize` has not ran or no API key was set.
@@ -129,14 +165,14 @@ def test_request_parameters_api_keys_in_params(self):
129165
self.assertIn('params', options)
130166

131167
self.assertIn('headers', options)
132-
168+
133169
# for resources in MyParamsApiKey, api key and application key needs to be in url params
134170
# any api and app keys in headers are ignored
135171
self.assertEqual(options['headers']['Content-Type'], 'application/json')
136172
self.assertEqual(options['params']['api_key'], API_KEY)
137173
self.assertEqual(options['params']['application_key'], APP_KEY)
138-
139-
174+
175+
140176

141177
def test_initialize_options(self):
142178
"""

0 commit comments

Comments
 (0)