MCPcopy Create free account
hub / github.com/apache/mesos / test_resource_get_json

Function test_resource_get_json

src/python/lib/tests/test_http.py:302–326  ·  view source on GitHub ↗
(mock_mesos_http_request)

Source from the content-addressed store, hash-verified

300
301
302def 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
329def test_resource_post_json(mock_mesos_http_request):

Callers

nothing calls this directly

Calls 2

get_jsonMethod · 0.95
callMethod · 0.45

Tested by

no test coverage detected