|
43 | 43 |
|
44 | 44 | class TestInitialization(DatadogAPINoInitialization): |
45 | 45 |
|
| 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 | + |
46 | 82 | def test_no_initialization_fails(self): |
47 | 83 | """ |
48 | 84 | 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): |
129 | 165 | self.assertIn('params', options) |
130 | 166 |
|
131 | 167 | self.assertIn('headers', options) |
132 | | - |
| 168 | + |
133 | 169 | # for resources in MyParamsApiKey, api key and application key needs to be in url params |
134 | 170 | # any api and app keys in headers are ignored |
135 | 171 | self.assertEqual(options['headers']['Content-Type'], 'application/json') |
136 | 172 | self.assertEqual(options['params']['api_key'], API_KEY) |
137 | 173 | self.assertEqual(options['params']['application_key'], APP_KEY) |
138 | | - |
139 | | - |
| 174 | + |
| 175 | + |
140 | 176 |
|
141 | 177 | def test_initialize_options(self): |
142 | 178 | """ |
|
0 commit comments