def session(self, base_url="http://testserver"): """Cached Testing HTTP client based on Requests by Kenneth Reitz.""" if self._session is None: session = RequestsSession() session.mount(base_url, RequestsWSGIAdapter(self)) self._session = session return self._session
def test_session(self, base_url="http://testserver"): """ Creates a test client associated with the given a url. The test session will be a requests session to be able to emulate a client in the browser. """ session = RequestsSession() session.mount(prefix=base_url, adapter=RequestsWSGIAdapter(self)) return session
def session(self, base_url="http://;"): """Testing HTTP client. Returns a Requests session object, able to send HTTP requests to the WSGI application. :param base_url: The URL to mount the connection adaptor to. """ if self._session is None: session = RequestsSession() session.mount(base_url, RequestsWSGIAdapter(self)) self._session = session return self._session
def test_session(self, base_url="http://localserver"): """ Creates a session so we can use requests whilst testing. Any URL that starts with base_url will be passed to the adapter :param base_url: url to use as a local test server :return: session with a mounted WSGI adapter :rtype: RequestsSession """ session = RequestsSession() session.mount(prefix=base_url, adapter=RequestsWSGIAdapter(self)) return session
def session(self, base_url="http://app"): if self._session is None: session = RequestsSession() session.mount(base_url, RequestsWSGIAdapter(self)) self._session = session return self._session
def test_session(self, base_url="http://testserver"): session = RequestSession() session.mount(prefix=base_url, adapter=RequestsWSGIAdapter(self)) return session
def test_session(self, base_url=BASE_URL): session = RequestsSession() session.mount(prefix=base_url, adapter=RequestsWSGIAdapter(self)) return session
def client(app): session = RequestsSession() session.mount(prefix=BASE_URL, adapter=RequestsWSGIAdapter(app)) return session
def session(self, base_url="http://testserver"): if self._session is None: session = RequestsSession() session.mount(prefix=base_url, adapter=RequestsWSGIAdapter(self)) self._session = session return self._session
def test_session(self, base_url="http://testserver") -> RequestsSession: """Used for Testing""" session = RequestsSession() session.mount(prefix=base_url, adapter=RequestsWSGIAdapter(self)) return session
def test_client(self, base_url='http://testserv'): session = RequestsSession() session.mount(prefix=base_url, adapter=RequestsWSGIAdapter(self)) return session