def test_fetch_from_url_or_retry_post_json(self):
# mocked requests
identifier = "1csb, 2pah"
base_url = c.http_pdbe
endpoint_url = "api/pdb/entry/summary/"
response = response_mocker(kwargs={}, base_url=base_url,
endpoint_url=endpoint_url,
content_type='application/octet-stream',
post=True, data=identifier)
self.fetch_from_url_or_retry = MagicMock(return_value=response)
url = base_url + endpoint_url + identifier
r = self.fetch_from_url_or_retry(url, json=True, post=True, data=identifier,
header={'application/octet-stream'},
retry_in=None, wait=0,
n_retries=10, stream=False).json()
self.assertEqual(r, json.loads('{"data": "some json formatted output"}'))
评论列表
文章目录