From: Alexander Cecile Date: Fri, 28 Aug 2020 07:18:41 +0000 (-0400) Subject: Remove unused test code X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=d85c96576a0ed519944536f32889855bb9707cb6;p=stevenblack-hosts.git Remove unused test code --- diff --git a/testUpdateHostsFile.py b/testUpdateHostsFile.py index 3f09e2308..7ca920280 100644 --- a/testUpdateHostsFile.py +++ b/testUpdateHostsFile.py @@ -1408,77 +1408,6 @@ class TestRemoveOldHostsFile(BaseMockDir): # End File Logic -# Helper Functions -def mock_url_open(url): - """ - Mock of `urlopen` that returns the url in a `BytesIO` stream. - - Parameters - ---------- - url : str - The URL associated with the file to open. - - Returns - ------- - bytes_stream : BytesIO - The `url` input wrapped in a `BytesIO` stream. - """ - - return BytesIO(url) - - -def mock_url_open_fail(_): - """ - Mock of `urlopen` that fails with an Exception. - """ - - raise Exception() - - -def mock_url_open_read_fail(_): - """ - Mock of `urlopen` that returns an object that fails on `read`. - - Returns - ------- - file_mock : mock.Mock - A mock of a file object that fails when reading. - """ - - def fail_read(): - raise Exception() - - m = mock.Mock() - - m.read = fail_read - return m - - -def mock_url_open_decode_fail(_): - """ - Mock of `urlopen` that returns an object that fails on during decoding - the output of `urlopen`. - - Returns - ------- - file_mock : mock.Mock - A mock of a file object that fails when decoding the output. - """ - - def fail_decode(_): - raise Exception() - - def read(): - s = mock.Mock() - s.decode = fail_decode - - return s - - m = mock.Mock() - m.read = read - return m - - class DomainToIDNA(Base): def __init__(self, *args, **kwargs): super(DomainToIDNA, self).__init__(*args, **kwargs)