mirror of
https://github.com/StevenBlack/hosts.git
synced 2024-07-14 00:00:34 +02:00
Remove unused test code
This commit is contained in:
parent
ad35681244
commit
d85c96576a
@ -1408,77 +1408,6 @@ class TestRemoveOldHostsFile(BaseMockDir):
|
|||||||
# End File Logic
|
# 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):
|
class DomainToIDNA(Base):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(DomainToIDNA, self).__init__(*args, **kwargs)
|
super(DomainToIDNA, self).__init__(*args, **kwargs)
|
||||||
|
Loading…
Reference in New Issue
Block a user