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_closing_context_manager(self) -> None:
with closing(dbus_init()) as connection:
collection = get_any_collection(connection)
self.assertIsNotNone(collection)
label = collection.get_label()
self.assertIsNotNone(label)
def setUp(self) -> None:
self.connection = dbus_init()
#!/usr/bin/env python3
from contextlib import closing
import secretstorage
with closing(secretstorage.dbus_init()) as connection:
items = secretstorage.search_items(connection, {'application': 'secretstorage-test'})
for item in items:
print('Deleting item with label %r.' % item.get_label())
item.delete()
def setUp(self) -> None:
self.connection = secretstorage.dbus_init()
self.collection = secretstorage.get_any_collection(self.connection)
def test_closing_context_manager(self) -> None:
with closing(dbus_init()) as connection:
collection = get_any_collection(connection)
self.assertIsNotNone(collection)
label = collection.get_label()
self.assertIsNotNone(label)
def setUp(self) -> None:
self.connection = dbus_init()
self.collection = get_any_collection(self.connection)
def setUp(self) -> None:
self.connection = dbus_init()
self.collection = get_any_collection(self.connection)
self.created_timestamp = time.time()
self.item = self.collection.create_item('My item', ATTRIBUTES,
b'pa$$word')
self.other_item = self.collection.create_item('My item',
ATTRIBUTES, b'', content_type='data/null')
def setUp(self) -> None:
self.connection = dbus_init()
collection_path = "/org/freedesktop/secrets/collection/english"
self.collection = Collection(self.connection, collection_path)
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()