tests.http_tests module#
Tests for http module.
- class tests.http_tests.BinaryTestCase(*args, **kwargs)[source]#
Bases:
CheckHostnameMixin
,TestCase
Get binary file using requests and pywikibot.
- abstract_class = False#
- net = True#
- sites = {'upload.wikimedia.org': {'hostname': 'upload.wikimedia.org'}}#
- url = 'https://upload.wikimedia.org/wikipedia/commons/f/fc/MP_sounds.png'#
- class tests.http_tests.CharsetTestCase(*args, **kwargs)[source]#
Bases:
DisableSiteMixin
,TestCase
Test that HttpRequest correct handles the charsets given.
- CODEC_CANT_DECODE_RE = "codec can't decode byte"#
- LATIN1_BYTES = b'\xe4\xf6\xfc'#
- STR = 'äöü'#
- UTF8_BYTES = b'\xc3\xa4\xc3\xb6\xc3\xbc'#
- abstract_class = False#
- test_content_type_application_json_without_charset()[source]#
Test decoding without explicit charset but JSON content.
- class tests.http_tests.DataBodyParameterTestCase(*args, **kwargs)[source]#
Bases:
CheckHostnameMixin
,HttpbinTestCase
Test data and body params of fetch/request methods are equivalent.
- abstract_class = False#
- maxDiff = None#
- net = True#
- site = True#
- sites = {'httpbin': {'hostname': 'httpbin.org'}}#
- class tests.http_tests.DefaultUserAgentTestCase(*args, **kwargs)[source]#
Bases:
DisableSiteMixin
,TestCase
User agent formatting tests using the default config format string.
- abstract_class = False#
- class tests.http_tests.HttpTestCase(*args, **kwargs)[source]#
Bases:
CheckHostnameMixin
,TestCase
Tests for http module.
- abstract_class = False#
- net = True#
- site = True#
- sites = {'www-wp': {'hostname': 'www.wikipedia.org'}}#
- test_fetch()[source]#
Test http.fetch using http://www.wikipedia.org/.
- class tests.http_tests.HttpsCertificateTestCase(*args, **kwargs)[source]#
Bases:
CheckHostnameMixin
,TestCase
HTTPS certificate test.
- CERT_VERIFY_FAILED_RE = 'certificate verify failed'#
- abstract_class = False#
- net = True#
- sites = {'testssl-expire-r2i2.disig.sk': {'hostname': 'testssl-expire-r2i2.disig.sk'}}#
- class tests.http_tests.LiveFakeUserAgentTestCase(*args, **kwargs)[source]#
Bases:
CheckHostnameMixin
,HttpbinTestCase
Test the usage of fake user agent.
- abstract_class = False#
- net = True#
- site = True#
- sites = {'httpbin': {'hostname': 'httpbin.org'}}#
- class tests.http_tests.QueryStringParamsTestCase(*args, **kwargs)[source]#
Bases:
CheckHostnameMixin
,HttpbinTestCase
Test the query string parameter of request methods.
The /get endpoint of httpbin returns JSON that can include an ‘args’ key with urldecoded query string parameters.
- abstract_class = False#
- net = True#
- site = True#
- sites = {'httpbin': {'hostname': 'httpbin.org'}}#
- class tests.http_tests.TestGetAuthenticationConfig(*args, **kwargs)[source]#
Bases:
DisableSiteMixin
,TestCase
Test http.get_authentication.
- abstract_class = False#
- class tests.http_tests.TestHttpStatus(*args, **kwargs)[source]#
Bases:
CheckHostnameMixin
,HttpbinTestCase
Test HTTP status code handling and errors.
- abstract_class = False#
- net = True#
- site = True#
- sites = {'enwp': {'hostname': 'en.wikipedia.org'}, 'httpbin': {'hostname': 'httpbin.org'}, 'wikia': {'hostname': 'en.wikia.com'}}#
- class tests.http_tests.UserAgentTestCase(*args, **kwargs)[source]#
Bases:
DisableSiteMixin
,TestCase
User agent formatting tests using a format string.
- abstract_class = False#