Ver Fonte

Test that storage is locked when hook runs

Test for 65af0592d339e0d40ed9a688627feb91b020baae
Unrud há 9 anos atrás
pai
commit
080ed31d27
1 ficheiros alterados com 10 adições e 0 exclusões
  1. 10 0
      radicale/tests/test_base.py

+ 10 - 0
radicale/tests/test_base.py

@@ -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."""