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

Method test_invalid_url

testUpdateHostsFile.py:1756–1766  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1754 )
1755
1756 def test_invalid_url(self):
1757 test_url = "http://fe80::5054:ff:fe5a:fc0" # leads to exception: InvalidURL
1758 with mock.patch(
1759 "requests.get", side_effect=requests.exceptions.ConnectionError
1760 ):
1761 return_value = get_file_by_url(test_url)
1762 self.assertIsNone(return_value)
1763 printed_output = sys.stdout.getvalue()
1764 self.assertEqual(
1765 printed_output, "Error retrieving data from {}\n".format(test_url)
1766 )
1767
1768
1769class TestWriteData(Base):

Callers

nothing calls this directly

Calls 1

get_file_by_urlFunction · 0.90

Tested by

no test coverage detected