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

Method test_invalid_then_valid

testUpdateHostsFile.py:1832–1847  ·  view source on GitHub ↗
(self, _)

Source from the content-addressed store, hash-verified

1830
1831 @mock.patch("updateHostsFile.input", side_effect=["foo", "yes", "foo", "no"])
1832 def test_invalid_then_valid(self, _):
1833 expected = "Please respond with 'yes' or 'no'"
1834
1835 # The first time, we respond "yes"
1836 self.assertTrue(query_yes_no("?", None))
1837
1838 output = sys.stdout.getvalue()
1839 self.assertIn(expected, output)
1840
1841 sys.stdout = StringIO()
1842
1843 # The second time, we respond "no"
1844 self.assertFalse(query_yes_no("?", None))
1845
1846 output = sys.stdout.getvalue()
1847 self.assertIn(expected, output)
1848
1849
1850class TestIsValidUserProvidedDomainFormat(BaseStdout):

Callers

nothing calls this directly

Calls 1

query_yes_noFunction · 0.90

Tested by

no test coverage detected