| 300 | |
| 301 | |
| 302 | def test_resource_get_json(mock_mesos_http_request): |
| 303 | mock_mesos_http_request.return_value = mock.Mock( |
| 304 | status_code=200, |
| 305 | text=ujson.dumps({'hello': 'world'}), |
| 306 | ) |
| 307 | mock_auth = mock.Mock() |
| 308 | resource = http.Resource('http://some.domain/some/prefix', |
| 309 | default_timeout=100, |
| 310 | default_auth=mock_auth, |
| 311 | default_max_attempts=1, |
| 312 | default_use_gzip_encoding=True) |
| 313 | ret = resource.get_json() |
| 314 | assert mock_mesos_http_request.mock_calls == [ |
| 315 | mock.call( |
| 316 | json=None, |
| 317 | method='GET', |
| 318 | url='http://some.domain/some/prefix', |
| 319 | auth=mock_auth, |
| 320 | headers={'Accept-Encoding': 'gzip', |
| 321 | 'Accept': 'application/json'}, |
| 322 | params=None, |
| 323 | timeout=100, |
| 324 | ) |
| 325 | ] |
| 326 | assert ret == {'hello': 'world'} |
| 327 | |
| 328 | |
| 329 | def test_resource_post_json(mock_mesos_http_request): |