Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_lock_unlock(self) -> None:
self.assertFalse(self.collection.is_locked())
self.collection.lock()
self.assertTrue(self.collection.is_locked())
self.assertRaises(LockedException, self.collection.ensure_not_locked)
item, = self.collection.search_items({"number": "1"})
self.assertRaises(LockedException, item.ensure_not_locked)
self.assertIs(self.collection.unlock(), False)
self.assertFalse(self.collection.is_locked())
self.collection.ensure_not_locked()
def test_lock_unlock(self) -> None:
self.assertFalse(self.collection.is_locked())
self.collection.lock()
self.assertTrue(self.collection.is_locked())
self.assertRaises(LockedException, self.collection.ensure_not_locked)
item, = self.collection.search_items({"number": "1"})
self.assertRaises(LockedException, item.ensure_not_locked)
self.assertIs(self.collection.unlock(), False)
self.assertFalse(self.collection.is_locked())
self.collection.ensure_not_locked()
def ensure_not_locked(self) -> None:
"""If collection is locked, raises
:exc:`~secretstorage.exceptions.LockedException`."""
if self.is_locked():
raise LockedException('Item is locked!')
def ensure_not_locked(self):
"""If collection is locked, raises
:exc:`~secretstorage.exceptions.LockedException`."""
if self.is_locked():
raise LockedException('Collection is locked!')
def ensure_not_locked(self) -> None:
"""If collection is locked, raises
:exc:`~secretstorage.exceptions.LockedException`."""
if self.is_locked():
raise LockedException('Collection is locked!')
def ensure_not_locked(self):
"""If collection is locked, raises
:exc:`~secretstorage.exceptions.LockedException`."""
if self.is_locked():
raise LockedException('Item is locked!')