def test_sqlite_open(self): _key = kvlite.get_uuid(1)[0] collection = kvlite.open('sqlite://tests/db/testdb.sqlite:kvlite_test') collection.put(_key, 1) self.assertEqual(collection.count, 1) self.assertEqual(collection.get({'_key': _key}), (_key, 1)) collection.delete(_key) self.assertEqual(collection.count, 0) self.assertEqual(collection.get({'_key': _key}), (None, None)) collection.close()
def test_sqlite_open(self): _key = kvlite.get_uuid(1)[0] collection = kvlite.open('sqlite://tests/db/testdb.sqlite:kvlite_test') collection.put(_key,1) self.assertEqual(collection.count,1) self.assertEqual(collection.get({'_key': _key}), (_key,1)) collection.delete(_key) self.assertEqual(collection.count,0) self.assertEqual(collection.get({'_key': _key}), (None,None)) collection.close()
def test_get_uuid(self): uuids = kvlite.get_uuid(1000) self.assertEqual(len(set(uuids)), 1000)