remove unsafe flag from handlers

This flag became reduntant there and tree creation has been moved to
lock
This commit is contained in:
2023-07-07 03:15:02 +03:00
parent 721b447767
commit b7852f55c8
71 changed files with 150 additions and 247 deletions

View File

@ -57,8 +57,11 @@ def test_check_user(lock: Lock, mocker: MockerFixture) -> None:
must check user correctly
"""
check_user_patch = mocker.patch("ahriman.application.lock.check_user")
tree_create = mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
lock.check_user()
check_user_patch.assert_called_once_with(lock.paths, unsafe=False)
tree_create.assert_called_once_with()
def test_check_user_exception(lock: Lock, mocker: MockerFixture) -> None:
@ -70,10 +73,11 @@ def test_check_user_exception(lock: Lock, mocker: MockerFixture) -> None:
lock.check_user()
def test_check_user_unsafe(lock: Lock) -> None:
def test_check_user_unsafe(lock: Lock, mocker: MockerFixture) -> None:
"""
must skip user check if unsafe flag set
"""
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.tree_create")
lock.unsafe = True
lock.check_user()