Skip to content

Commit

Permalink
ZO-4267: extend mock connector to fullfil locking contract
Browse files Browse the repository at this point in the history
  • Loading branch information
stollero committed Feb 29, 2024
1 parent 7d75841 commit 69f8d8b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion core/src/zeit/connector/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
import zope.event

from zeit.connector.connector import CannonicalId
from zeit.connector.interfaces import ID_NAMESPACE, UUID_PROPERTY, CopyError, MoveError
from zeit.connector.interfaces import (
ID_NAMESPACE,
UUID_PROPERTY,
CopyError,
LockingError,
MoveError,
)
import zeit.connector.cache
import zeit.connector.dav.interfaces
import zeit.connector.filesystem
Expand Down Expand Up @@ -229,6 +235,8 @@ def changeProperties(self, id, properties):
def lock(self, id, principal, until):
"""Lock resource for principal until a given datetime."""
id = self._get_cannonical_id(id)
if id in self._locked:
raise LockingError('Resource is already locked by another principal')
self._locked[id] = (principal, until, True)

def unlock(self, id, locktoken=None):
Expand Down

0 comments on commit 69f8d8b

Please sign in to comment.