def test_authentication_fail_retry(monkeypatch): post_retry = RetryRecorder(error=KerberosExchangeError()) monkeypatch.setattr(TrinoRequest.http.Session, "post", post_retry) get_retry = RetryRecorder(error=KerberosExchangeError()) monkeypatch.setattr(TrinoRequest.http.Session, "get", get_retry) attempts = 3 kerberos_auth = KerberosAuthentication() req = TrinoRequest( host="coordinator", port=8080, user="******", http_scheme=constants.HTTPS, auth=kerberos_auth, max_attempts=attempts, ) with pytest.raises(KerberosExchangeError): req.post("URL") assert post_retry.retry_count == attempts with pytest.raises(KerberosExchangeError): req.get("URL") assert post_retry.retry_count == attempts
def test_authentication_fail_retry(monkeypatch): post_retry = RetryRecorder(error=KerberosExchangeError()) monkeypatch.setattr(PrestoRequest.http.Session, 'post', post_retry) get_retry = RetryRecorder(error=KerberosExchangeError()) monkeypatch.setattr(PrestoRequest.http.Session, 'get', get_retry) attempts = 3 req = PrestoRequest( host='coordinator', port=8080, user='******', max_attempts=attempts, ) with pytest.raises(KerberosExchangeError): req.post('URL') assert post_retry.retry_count == attempts with pytest.raises(KerberosExchangeError): req.get('URL') assert post_retry.retry_count == attempts