diff --git a/repos/system_upgrade/common/actors/systemfacts/tests/test_systemfacts.py b/repos/system_upgrade/common/actors/systemfacts/tests/test_systemfacts.py index badf174c16..5831b979af 100644 --- a/repos/system_upgrade/common/actors/systemfacts/tests/test_systemfacts.py +++ b/repos/system_upgrade/common/actors/systemfacts/tests/test_systemfacts.py @@ -3,7 +3,16 @@ import pytest -from leapp.libraries.actor.systemfacts import _get_system_groups, _get_system_users, anyendswith, anyhasprefix, aslist +from leapp.exceptions import StopActorExecutionError +from leapp.libraries.actor.systemfacts import ( + _get_system_groups, + _get_system_users, + anyendswith, + anyhasprefix, + aslist, + get_repositories_status +) +from leapp.libraries.common import repofileutils from leapp.libraries.common.testutils import logger_mocked from leapp.libraries.stdlib import api from leapp.snactor.fixture import current_actor_libraries @@ -116,3 +125,16 @@ def __init__(self, gr_name, gr_gid, gr_mem): assert group_name not in api.current_logger().dbgmsg[0] else: assert not api.current_logger().dbgmsg + + +def test_failed_parsed_repofiles(monkeypatch): + def _raise_invalidrepo_error(): + raise repofileutils.InvalidRepoDefinition(msg='mocked error', + repofile='/etc/yum.repos.d/mock.repo', + repoid='mocked repoid') + + monkeypatch.setattr(repofileutils, 'get_parsed_repofiles', _raise_invalidrepo_error) + monkeypatch.setattr(api, 'current_logger', logger_mocked()) + + with pytest.raises(StopActorExecutionError): + get_repositories_status()