def test_ignore_lines_from_file(ignores_file):
"""
Should return the lines in the given ignores file as list of lowercase strings.
"""
config = ['hostname ROUTER']
expected = ignores_file.lower().split('\n')
ignores_data = mock.mock_open(read_data=ignores_file)
with mock.patch('diffios.config.os.path.isfile') as mock_isfile:
mock_isfile.return_value = True
with mock.patch(
'diffios.config.open', ignores_data, create=True) as mock_open:
actual = diffios.Config(
config, ignore_lines='ignores_file').ignore_lines
mock_open.assert_called_once_with('ignores_file')
assert expected == actual
评论列表
文章目录