From 080ed31d2721605af7b1f9428e1f93fda13d3162 Mon Sep 17 00:00:00 2001 From: Unrud Date: Thu, 11 Aug 2016 00:27:48 +0200 Subject: [PATCH] Test that storage is locked when hook runs Test for 65af0592d339e0d40ed9a688627feb91b020baae --- radicale/tests/test_base.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/radicale/tests/test_base.py b/radicale/tests/test_base.py index 88b1cec..ecac00e 100644 --- a/radicale/tests/test_base.py +++ b/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."""