MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / test_safe_fetch_text_decodes_utf8

Function test_safe_fetch_text_decodes_utf8

tests/test_security.py:151–159  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

149# ---------------------------------------------------------------------------
150
151def test_safe_fetch_text_decodes_utf8():
152 content = "héllo wörld".encode("utf-8")
153 mock_resp = _make_mock_response(content)
154 with patch("graphify.security._build_opener") as mock_opener_fn:
155 mock_opener = MagicMock()
156 mock_opener.open.return_value = mock_resp
157 mock_opener_fn.return_value = mock_opener
158 result = safe_fetch_text("https://example.com/")
159 assert result == "héllo wörld"
160
161def test_safe_fetch_text_replaces_bad_bytes():
162 bad = b"hello \xff world"

Callers

nothing calls this directly

Calls 2

safe_fetch_textFunction · 0.90
_make_mock_responseFunction · 0.85

Tested by

no test coverage detected