def test_request_info_with_fragment(make_request: Any) -> None: req = make_request("get", "http://python.org/#urlfragment") assert req.request_info == aiohttp.RequestInfo( URL("http://python.org/"), "GET", req.headers, URL("http://python.org/#urlfragment"), )
def maybe_fail(self, method, path, headers): if self.should_fail(): raise aiohttp.ClientResponseError( status=503, message= 'Service Unavailable from FailureInjectingClientSession', request_info=aiohttp.RequestInfo(url=path, method=method, headers=headers, real_url=path), history=())
def test_request_info_with_fragment(make_request) -> None: req = make_request('get', 'http://python.org/#urlfragment') assert req.request_info == aiohttp.RequestInfo( URL('http://python.org/'), 'GET', req.headers, URL('http://python.org/#urlfragment'))
def test_request_info(make_request) -> None: req = make_request('get', 'http://python.org/') assert req.request_info == aiohttp.RequestInfo(URL('http://python.org/'), 'GET', req.headers)
def request_info(self) -> aiohttp.RequestInfo: """Return a container with generic request information.""" return aiohttp.RequestInfo(self.real_url, 'get', {}) # type: ignore
import asyncio from http import HTTPStatus import aiohttp import pytest from multidict import CIMultiDict, CIMultiDictProxy from yarl import URL from galaxy.api.errors import (AccessDenied, AuthenticationRequired, BackendTimeout, BackendNotAvailable, BackendError, NetworkError, TooManyRequests, UnknownBackendResponse, UnknownError) from galaxy.http import handle_exception request_info = aiohttp.RequestInfo(URL("http://o.pl"), "GET", CIMultiDictProxy(CIMultiDict())) @pytest.mark.parametrize( "aiohttp_exception,expected_exception_type", [(asyncio.TimeoutError(), BackendTimeout), (aiohttp.ServerDisconnectedError(), BackendNotAvailable), (aiohttp.ClientConnectionError(), NetworkError), (aiohttp.ContentTypeError(request_info, ()), UnknownBackendResponse), (aiohttp.ClientResponseError( request_info, (), status=HTTPStatus.UNAUTHORIZED), AuthenticationRequired), (aiohttp.ClientResponseError(request_info, (), status=HTTPStatus.FORBIDDEN), AccessDenied), (aiohttp.ClientResponseError( request_info,
def test_request_info(make_request: Any) -> None: req = make_request("get", "http://python.org/") assert req.request_info == aiohttp.RequestInfo(URL("http://python.org/"), "GET", req.headers)
import asyncio from http import HTTPStatus import aiohttp import pytest from galaxy.api.errors import (AccessDenied, AuthenticationRequired, BackendTimeout, BackendNotAvailable, BackendError, NetworkError, TooManyRequests, UnknownBackendResponse, UnknownError) from galaxy.http import handle_exception request_info = aiohttp.RequestInfo("http://o.pl", "GET", {}) @pytest.mark.parametrize( "aiohttp_exception,expected_exception_type", [(asyncio.TimeoutError(), BackendTimeout), (aiohttp.ServerDisconnectedError(), BackendNotAvailable), (aiohttp.ClientConnectionError(), NetworkError), (aiohttp.ContentTypeError(request_info, []), UnknownBackendResponse), (aiohttp.ClientResponseError( request_info, [], status=HTTPStatus.UNAUTHORIZED), AuthenticationRequired), (aiohttp.ClientResponseError(request_info, [], status=HTTPStatus.FORBIDDEN), AccessDenied), (aiohttp.ClientResponseError( request_info, [], status=HTTPStatus.SERVICE_UNAVAILABLE), BackendNotAvailable), (aiohttp.ClientResponseError( request_info, [],