Example #1
0
 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
Example #2
0
 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
Example #3
0
    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
Example #4
0
 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
Example #5
0
 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
Example #6
0
 def test_session(self, base_url="http://testserver"):
     session = RequestSession()
     session.mount(prefix=base_url, adapter=RequestsWSGIAdapter(self))
     return session
Example #7
0
 def test_session(self, base_url=BASE_URL):
     session = RequestsSession()
     session.mount(prefix=base_url, adapter=RequestsWSGIAdapter(self))
     return session
Example #8
0
def client(app):
    session = RequestsSession()
    session.mount(prefix=BASE_URL, adapter=RequestsWSGIAdapter(app))
    return session
Example #9
0
 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
Example #10
0
 def test_session(self, base_url="http://testserver") -> RequestsSession:
     """Used for Testing"""
     session = RequestsSession()
     session.mount(prefix=base_url, adapter=RequestsWSGIAdapter(self))
     return session
Example #11
0
 def test_client(self, base_url='http://testserv'):
     session = RequestsSession()
     session.mount(prefix=base_url, adapter=RequestsWSGIAdapter(self))
     return session