MCPcopy
hub / github.com/StevenBlack/hosts / test_basic

Method test_basic

testUpdateHostsFile.py:1718–1728  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1716
1717class GetFileByUrl(BaseStdout):
1718 def test_basic(self):
1719 raw_resp_content = "hello, ".encode("ascii") + "world".encode("utf-8")
1720 resp_obj = requests.Response()
1721 resp_obj.__setstate__({"_content": raw_resp_content})
1722
1723 expected = "hello, world"
1724
1725 with mock.patch("requests.get", return_value=resp_obj):
1726 actual = get_file_by_url("www.test-url.com")
1727
1728 self.assertEqual(expected, actual)
1729
1730 def test_with_idna(self):
1731 raw_resp_content = b"www.huala\xc3\xb1e.cl"

Callers

nothing calls this directly

Calls 1

get_file_by_urlFunction · 0.90

Tested by

no test coverage detected