mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-07-15 06:55:48 +00:00
feat: implement local reporter mode (#126)
* implement local reporter mode * simplify watcher class * review changes * do not update unknown status * allow empty key patches via api * fix some pylint warnings in tests
This commit is contained in:
@ -27,7 +27,7 @@ def test_path(args: argparse.Namespace, configuration: Configuration) -> None:
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
args.lock = Path("/")
|
||||
Lock(args, repository_id, configuration).path # special case
|
||||
assert Lock(args, repository_id, configuration).path # special case
|
||||
|
||||
|
||||
def test_check_user(lock: Lock, mocker: MockerFixture) -> None:
|
||||
@ -64,7 +64,7 @@ def test_check_version(lock: Lock, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must check version correctly
|
||||
"""
|
||||
mocker.patch("ahriman.core.status.client.Client.status_get",
|
||||
mocker.patch("ahriman.core.status.Client.status_get",
|
||||
return_value=InternalStatus(status=BuildStatus(), version=__version__))
|
||||
logging_mock = mocker.patch("logging.Logger.warning")
|
||||
|
||||
@ -76,7 +76,7 @@ def test_check_version_mismatch(lock: Lock, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must check mismatched version correctly
|
||||
"""
|
||||
mocker.patch("ahriman.core.status.client.Client.status_get",
|
||||
mocker.patch("ahriman.core.status.Client.status_get",
|
||||
return_value=InternalStatus(status=BuildStatus(), version="version"))
|
||||
logging_mock = mocker.patch("logging.Logger.warning")
|
||||
|
||||
@ -184,7 +184,7 @@ def test_enter(lock: Lock, mocker: MockerFixture) -> None:
|
||||
watch_mock = mocker.patch("ahriman.application.lock.Lock.watch")
|
||||
clear_mock = mocker.patch("ahriman.application.lock.Lock.clear")
|
||||
create_mock = mocker.patch("ahriman.application.lock.Lock.create")
|
||||
update_status_mock = mocker.patch("ahriman.core.status.client.Client.status_update")
|
||||
update_status_mock = mocker.patch("ahriman.core.status.Client.status_update")
|
||||
|
||||
with lock:
|
||||
pass
|
||||
@ -203,9 +203,9 @@ def test_exit_with_exception(lock: Lock, mocker: MockerFixture) -> None:
|
||||
mocker.patch("ahriman.application.lock.Lock.check_user")
|
||||
mocker.patch("ahriman.application.lock.Lock.clear")
|
||||
mocker.patch("ahriman.application.lock.Lock.create")
|
||||
update_status_mock = mocker.patch("ahriman.core.status.client.Client.status_update")
|
||||
update_status_mock = mocker.patch("ahriman.core.status.Client.status_update")
|
||||
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(ValueError):
|
||||
with lock:
|
||||
raise Exception()
|
||||
raise ValueError()
|
||||
update_status_mock.assert_has_calls([MockCall(BuildStatusEnum.Building), MockCall(BuildStatusEnum.Failed)])
|
||||
|
Reference in New Issue
Block a user