class documentation

class HTTPClientTests(TestCase): (source)

View In Hierarchy

Undocumented

Method assertBody Undocumented
Method setUp Undocumented
Method test_post Undocumented
Method test_request_browser_like_redirects Undocumented
Method test_request_case_insensitive_methods Undocumented
Method test_request_data_dict Undocumented
Method test_request_data_file Undocumented
Method test_request_data_single_dict Undocumented
Method test_request_data_tuple Undocumented
Method test_request_dict_headers Undocumented
Method test_request_dict_headers_invalid_values `HTTPClient.request()` warns that non-string header values are dropped and that this behavior is deprecated.
Method test_request_dict_single_value_query_params Undocumented
Method test_request_files_tuple_too_long The `HTTPClient.request()` *files* argument requires tuples of length 2 or 3. It raises `TypeError` when the tuple is too long.
Method test_request_files_tuple_too_short The `HTTPClient.request()` *files* argument requires tuples of length 2 or 3. It raises `TypeError` when the tuple is too short.
Method test_request_headers_invalid_type `HTTPClient.request()` warns that headers of an unexpected type are invalid and that this behavior is deprecated.
Method test_request_headers_object The *headers* parameter accepts a `twisted.web.http_headers.Headers` instance.
Method test_request_invalid_param `HTTPClient.request()` rejects invalid keyword parameters with `TypeError`.
Method test_request_json_bool Undocumented
Method test_request_json_dict Undocumented
Method test_request_json_none Undocumented
Method test_request_json_number Undocumented
Method test_request_json_string Undocumented
Method test_request_json_tuple Undocumented
Method test_request_json_with_data Passing `HTTPClient.request()` both *data* and *json* parameters is invalid because *json* is ignored. This behavior is deprecated.
Method test_request_json_with_files Passing `HTTPClient.request()` both *files* and *json* parameters is invalid because *json* is ignored. This behavior is deprecated.
Method test_request_merge_query_params Undocumented
Method test_request_merge_tuple_query_params Undocumented
Method test_request_mixed_params Undocumented
Method test_request_mixed_params_dict Undocumented
Method test_request_named_attachment Undocumented
Method test_request_named_attachment_and_ctype Undocumented
Method test_request_no_name_attachment Undocumented
Method test_request_post_redirect_denied Undocumented
Method test_request_query_param_seps When the characters ``&`` and ``#`` are passed to *params* as param names or values they are percent-escaped in the URL.
Method test_request_query_params Undocumented
Method test_request_timeout_cancelled Verify timeout is cancelled if a response is received before timeout period elapses.
Method test_request_timeout_fired Verify the request is cancelled if a response is not received within specified timeout period.
Method test_request_tuple_query_param_coercion treq coerces non-string param names passed to *params* like `urllib.urlencode()`
Method test_request_tuple_query_value_coercion treq coerces non-string values passed to *params* like `urllib.urlencode()`
Method test_request_tuple_query_values Undocumented
Method test_request_unsupported_params_combination Undocumented
Method test_request_uri_bytes_pass The URL parameter may contain path segments or querystring parameters that are not valid UTF-8. These pass through.
Method test_request_uri_decodedurl A URL may be passed as a `hyperlink.DecodedURL` object. It is converted to bytes when passed to the underlying agent.
Method test_request_uri_encodedurl A URL may be passed as a `hyperlink.EncodedURL` object. It is converted to bytes when passed to the underlying agent.
Method test_request_uri_hyperlink_params The *params* argument augments an instance of `hyperlink.DecodedURL` passed as the *url* parameter, just as if it were a string.
Method test_request_uri_idn Undocumented
Method test_request_uri_idn_params A URL that contains non-ASCII characters can be augmented with querystring parameters.
Method test_request_uri_plus_pass URL parameters may contain spaces encoded as ``+``. These remain as such and are not mangled.
Method test_response_buffering_is_disabled_with_unbufferred_arg Undocumented
Method test_response_is_buffered Undocumented
Instance Variable agent Undocumented
Instance Variable client Undocumented
Instance Variable fbp_patcher Undocumented
Instance Variable FileBodyProducer Undocumented
Instance Variable mbp_patcher Undocumented
Instance Variable MultiPartProducer Undocumented
def assertBody(self, expected): (source)

Undocumented

def setUp(self): (source)

Undocumented

def test_post(self): (source)

Undocumented

def test_request_browser_like_redirects(self): (source)

Undocumented

def test_request_case_insensitive_methods(self): (source)

Undocumented

def test_request_data_dict(self): (source)

Undocumented

def test_request_data_file(self): (source)

Undocumented

def test_request_data_single_dict(self): (source)

Undocumented

def test_request_data_tuple(self): (source)

Undocumented

def test_request_dict_headers(self): (source)

Undocumented

def test_request_dict_headers_invalid_values(self): (source)

`HTTPClient.request()` warns that non-string header values are dropped and that this behavior is deprecated.

def test_request_dict_single_value_query_params(self): (source)

Undocumented

def test_request_files_tuple_too_long(self): (source)

The `HTTPClient.request()` *files* argument requires tuples of length 2 or 3. It raises `TypeError` when the tuple is too long.

def test_request_files_tuple_too_short(self): (source)

The `HTTPClient.request()` *files* argument requires tuples of length 2 or 3. It raises `TypeError` when the tuple is too short.

def test_request_headers_invalid_type(self): (source)

`HTTPClient.request()` warns that headers of an unexpected type are invalid and that this behavior is deprecated.

def test_request_headers_object(self): (source)

The *headers* parameter accepts a `twisted.web.http_headers.Headers` instance.

def test_request_invalid_param(self): (source)

`HTTPClient.request()` rejects invalid keyword parameters with `TypeError`.

def test_request_json_bool(self): (source)

Undocumented

def test_request_json_dict(self): (source)

Undocumented

def test_request_json_none(self): (source)

Undocumented

def test_request_json_number(self): (source)

Undocumented

def test_request_json_string(self): (source)

Undocumented

def test_request_json_tuple(self): (source)

Undocumented

def test_request_json_with_data(self): (source)

Passing `HTTPClient.request()` both *data* and *json* parameters is invalid because *json* is ignored. This behavior is deprecated.

def test_request_json_with_files(self): (source)

Passing `HTTPClient.request()` both *files* and *json* parameters is invalid because *json* is ignored. This behavior is deprecated.

def test_request_merge_query_params(self): (source)

Undocumented

def test_request_merge_tuple_query_params(self): (source)

Undocumented

@mock.patch('treq.client.uuid.uuid4', mock.Mock(return_value='heyDavid'))
def test_request_mixed_params(self): (source)

Undocumented

@mock.patch('treq.client.uuid.uuid4', mock.Mock(return_value='heyDavid'))
def test_request_mixed_params_dict(self): (source)

Undocumented

@mock.patch('treq.client.uuid.uuid4', mock.Mock(return_value='heyDavid'))
def test_request_named_attachment(self): (source)

Undocumented

@mock.patch('treq.client.uuid.uuid4', mock.Mock(return_value='heyDavid'))
def test_request_named_attachment_and_ctype(self): (source)

Undocumented

@mock.patch('treq.client.uuid.uuid4', mock.Mock(return_value='heyDavid'))
def test_request_no_name_attachment(self): (source)

Undocumented

def test_request_post_redirect_denied(self): (source)

Undocumented

def test_request_query_param_seps(self): (source)

When the characters ``&`` and ``#`` are passed to *params* as param names or values they are percent-escaped in the URL. This reproduces https://github.com/twisted/treq/issues/282

def test_request_query_params(self): (source)

Undocumented

@with_clock
def test_request_timeout_cancelled(self, clock): (source)

Verify timeout is cancelled if a response is received before timeout period elapses.

@with_clock
def test_request_timeout_fired(self, clock): (source)

Verify the request is cancelled if a response is not received within specified timeout period.

def test_request_tuple_query_param_coercion(self): (source)

treq coerces non-string param names passed to *params* like `urllib.urlencode()`

def test_request_tuple_query_value_coercion(self): (source)

treq coerces non-string values passed to *params* like `urllib.urlencode()`

def test_request_tuple_query_values(self): (source)

Undocumented

def test_request_unsupported_params_combination(self): (source)

Undocumented

def test_request_uri_bytes_pass(self): (source)

The URL parameter may contain path segments or querystring parameters that are not valid UTF-8. These pass through.

def test_request_uri_decodedurl(self): (source)

A URL may be passed as a `hyperlink.DecodedURL` object. It is converted to bytes when passed to the underlying agent.

def test_request_uri_encodedurl(self): (source)

A URL may be passed as a `hyperlink.EncodedURL` object. It is converted to bytes when passed to the underlying agent.

def test_request_uri_hyperlink_params(self): (source)

The *params* argument augments an instance of `hyperlink.DecodedURL` passed as the *url* parameter, just as if it were a string.

def test_request_uri_idn(self): (source)

Undocumented

def test_request_uri_idn_params(self): (source)

A URL that contains non-ASCII characters can be augmented with querystring parameters. This reproduces treq #264.

def test_request_uri_plus_pass(self): (source)

URL parameters may contain spaces encoded as ``+``. These remain as such and are not mangled. This reproduces `Klein #339 <https://github.com/twisted/klein/issues/339>`_.

def test_response_buffering_is_disabled_with_unbufferred_arg(self): (source)

Undocumented

def test_response_is_buffered(self): (source)

Undocumented

agent = (source)

Undocumented

client = (source)

Undocumented

fbp_patcher = (source)

Undocumented

FileBodyProducer = (source)

Undocumented

mbp_patcher = (source)

Undocumented

MultiPartProducer = (source)

Undocumented