requests_mock.exceptions.InvalidRequest

Here are the examples of the python api requests_mock.exceptions.InvalidRequest taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

6 Examples 7

Example 1

Project: fjord
Source File: response.py
View license
    def send(self, request, **kwargs):
        msg = 'This response was created without a connection. You are ' \
              'therefore unable to make a request directly on that connection.'
        raise exceptions.InvalidRequest(msg)

Example 2

Project: fjord
Source File: test_response.py
View license
    def test_send_from_no_connection(self):
        resp = self.create_response()
        self.assertRaises(exceptions.InvalidRequest,
                          resp.connection.send, self.request)

Example 3

Project: fjord
Source File: response.py
View license
    def send(self, request, **kwargs):
        msg = 'This response was created without a connection. You are ' \
              'therefore unable to make a request directly on that connection.'
        raise exceptions.InvalidRequest(msg)

Example 4

Project: fjord
Source File: test_response.py
View license
    def test_send_from_no_connection(self):
        resp = self.create_response()
        self.assertRaises(exceptions.InvalidRequest,
                          resp.connection.send, self.request)

Example 5

Project: requests-mock
Source File: response.py
View license
    def send(self, request, **kwargs):
        msg = 'This response was created without a connection. You are ' \
              'therefore unable to make a request directly on that connection.'
        raise exceptions.InvalidRequest(msg)

Example 6

Project: requests-mock
Source File: test_response.py
View license
    def test_send_from_no_connection(self):
        resp = self.create_response()
        self.assertRaises(exceptions.InvalidRequest,
                          resp.connection.send, self.request)