Skip to content

Commit 826251e

Browse files
committed
Updated testing
Signed-off-by: shlao <[email protected]>
1 parent f1fc6aa commit 826251e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

insights/tests/datasources/test_host_key_files.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
import pytest
2+
13
from mock.mock import patch, mock_open
4+
from insights.core.dr import SkipComponent
25
from insights.core.spec_factory import DatasourceProvider
36
from insights.specs.datasources.host_key_files import host_key_files
47

@@ -31,3 +34,14 @@ def test_host_key_files(mock_exists, mock_ds_open):
3134

3235
expected = DatasourceProvider(content=EXPECTED_RESULT, relative_path=RELATIVE_PATH)
3336
assert len(result.content) == len(expected.content) == 2
37+
38+
39+
@patch(
40+
'insights.specs.datasources.host_key_files.open', new_callable=mock_open, read_data=[""]
41+
)
42+
@patch('os.path.exists')
43+
def test_host_key_files_empty_log(mock_exists, mock_ds_open):
44+
broker = {}
45+
with pytest.raises(SkipComponent) as e:
46+
host_key_files(broker)
47+
assert 'SkipComponent' in str(e)

0 commit comments

Comments
 (0)