def test_get_formatted_status_permission_error(mocked_stat):
    doc_pair = DocPair()
    path = pathlib.Path(".")

    mocked_stat.side_effect = PermissionError
    status = get_formatted_status(doc_pair, path)
    mocked_stat.reset_mock()

    assert status == {"path": ".", "value": str(Status.LOCKED.value)}
def test_get_formatted_status_readonly(mocked_stat):
    doc_pair = DocPair()
    path = pathlib.Path(".")

    class Stat:
        st_mode = 0

    mocked_stat.return_value = Stat
    status = get_formatted_status(doc_pair, path)
    mocked_stat.reset_mock()

    assert status == {"path": ".", "value": str(Status.LOCKED.value)}
def test_get_formatted_status_file_not_found():
    doc_pair = DocPair()
    path = pathlib.Path("./inexistant")
    assert get_formatted_status(doc_pair, path) is None
def test_get_formatted_status(doc_pair, path, status):
    fmt_status = get_formatted_status(doc_pair, path)
    assert fmt_status == {"path": ".", "value": str(status.value)}