tests.test_http moduleΒΆ

Tests for the shared HTTP fetch and cache mechanics.

tests.test_http.test_get_json_retries_incomplete_read(truncations)[source]ΒΆ

A truncated body is retried after each pause of the backoff.

tests.test_http.test_get_json_persistent_incomplete_read()[source]ΒΆ

A body truncated on every retry raises FetchError.

tests.test_http.test_get_text_decodes_body()[source]ΒΆ

A text fetch returns the decoded body rather than a parsed value.

tests.test_http.test_get_text_rejects_undecodable_body()[source]ΒΆ

A body that is not UTF-8 is a failed fetch, not mojibake.

tests.test_http.test_get_text_retries_incomplete_read()[source]ΒΆ

A truncated text body earns the same retries as a JSON one.

tests.test_http.test_get_cached_json_fetches_and_stores()[source]ΒΆ

A cache miss fetches over HTTP and stores the raw response body.

tests.test_http.test_get_cached_json_uses_cache_when_fresh()[source]ΒΆ

A cache hit is parsed and returned without any HTTP request.

tests.test_http.test_get_cached_json_ignores_corrupt_cache()[source]ΒΆ

A cache entry that no longer parses falls through to a fresh fetch.

tests.test_http.test_get_cached_json_returns_none_on_fetch_error()[source]ΒΆ

An HTTP or network failure is swallowed into a None result.

tests.test_http.test_get_cached_json_skips_store_when_ttl_disabled()[source]ΒΆ

With caching disabled (ttl == 0), a fetched body is not stored.

tests.test_http.test_suite_refuses_an_unmocked_fetch()[source]ΒΆ

A fetch that no test stubbed fails at once.

The _no_real_http fixture of tests/conftest.py holds this. The .invalid domain never resolves, so a suite that lost the fixture fails here on the message instead of reaching a real host.