def remove(uri): ''' remove collection by URI ''' manager = CollectionManager(uri) params = manager.parse_uri(uri) if params['collection'] in manager.collections(): manager.remove(params['collection'])
def test_sqlite_manager(self): URI = 'sqlite://tests/db/testdb.sqlite' collection_name = 'kvlite_test' manager = CollectionManager(URI) if collection_name in manager.collections(): manager.remove(collection_name) self.assertNotIn(collection_name, manager.collections()) manager.create(collection_name) self.assertIn(collection_name, manager.collections()) manager.remove(collection_name) self.assertNotIn(collection_name, manager.collections())
def test_mysql_manager(self): URI = 'mysql://*****:*****@localhost/kvlite_test' collection_name = 'kvlite_test' manager = CollectionManager(URI) if collection_name in manager.collections(): manager.remove(collection_name) self.assertNotIn(collection_name, manager.collections()) manager.create(collection_name) self.assertIn(collection_name, manager.collections()) manager.remove(collection_name) self.assertNotIn(collection_name, manager.collections())