def test_delete_run_handles_500(requests_mock): rest_client = RestClient('http://testing-es-url') requests_mock.delete('http://testing-es-url/api/v1/projects/pid/runs/rid', text='', status_code=500) with pytest.raises(ServiceError): rest_client.run_delete('pid', 'rid', 'mykey') assert requests_mock.last_request.headers['Authorization'] == 'mykey'
def test_delete_run_handles_503(requests_mock): rest_client = RestClient( 'http://testing-es-url', ClientWaitingConfiguration(wait_exponential_max_ms=10, wait_exponential_multiplier_ms=1, stop_max_delay_ms=10)) requests_mock.delete('http://testing-es-url/api/v1/projects/pid/runs/rid', text='', status_code=503) with pytest.raises(ServiceError): rest_client.run_delete('pid', 'rid', 'mykey') assert requests_mock.last_request.headers['Authorization'] == 'mykey'