Test that storage is locked when hook runs

Test for 65af0592d3
This commit is contained in:
Unrud 2016-08-11 00:27:48 +02:00
parent 952609deee
commit 080ed31d27

View File

@ -25,6 +25,7 @@ import posixpath
import shutil
import tempfile
import pytest
from radicale import Application, config
from . import BaseTest
@ -771,6 +772,15 @@ class BaseRequestsMixIn:
status, headers, answer = self.request("GET", "/created_by_hook/")
assert status == 404
@pytest.mark.skipif(os.system("type flock") != 0,
reason="flock command not found")
def test_hook_storage_locked(self):
"""Verify that the storage is locked when the hook runs."""
self.configuration.set(
"storage", "hook", "flock -n .Radicale.lock || exit 0; exit 1")
status, headers, answer = self.request("MKCOL", "/calendar.ics/")
assert status == 201
class BaseFileSystemTest(BaseTest):
"""Base class for filesystem backend tests."""