def on_destroy(self, model_class): """ """ if not self.related_name is None: relation_name = self._get_relation_collection_name(model_class) Collection.remove(name=relation_name)
def on_destroy(self, model_class): """ """ if not self.related_name is None: relation_name = self._get_relation_collection_name(model_class) Collection.remove(name=relation_name)
def test_create_and_delete_collection_without_extra_db(self): collection_name = 'test_foo_123' col = Collection.create(name=collection_name) self.assertIsNotNone(col) Collection.remove(name=collection_name)
def test_create_and_delete_collection_without_extra_db(self): collection_name = 'test_foo_123' col = Collection.create(name=collection_name) self.assertIsNotNone(col) Collection.remove(name=collection_name)
def destroy(cls): """ """ # Go through all fields for attribute in cls.get_collection_fields(): attribute.on_destroy(cls) name = cls.get_collection_name() Collection.remove(name=name)
def destroy(cls): """ """ # Go through all fields for attribute in cls.get_collection_fields(): attribute.on_destroy(cls) name = cls.get_collection_name() Collection.remove(name=name)
def tearDown(self): # Delete index self.geo_index.delete() self.hash_index.delete() self.fulltext_index.delete() self.skiplist_index.delete() # They need to be deleted Collection.remove(name=self.test_1_col.name) Database.remove(name=self.database_name)
def tearDown(self): # Delete index self.geo_index.delete() self.hash_index.delete() self.fulltext_index.delete() self.skiplist_index.delete() # They need to be deleted Collection.remove(name=self.test_1_col.name) Database.remove(name=self.database_name)
def test_getting_new_info_for_collection(self): collection_name = 'test_foo_123' col = Collection.create(name=collection_name) retrieved_col = Collection.get_loaded_collection(name=collection_name) retrieved_col.set_data(waitForSync=True) retrieved_col.save() col.get() self.assertEqual(col.waitForSync, True) Collection.remove(name=collection_name)
def test_get_collection(self): collection_name = 'test_foo_123' col = Collection.create(name=collection_name) self.assertIsNotNone(col) retrieved_col = Collection.get_loaded_collection(name=collection_name) self.assertEqual(col.id, retrieved_col.id) self.assertEqual(col.name, retrieved_col.name) self.assertEqual(col.type, retrieved_col.type) Collection.remove(name=collection_name)
def test_getting_new_info_for_collection(self): collection_name = 'test_foo_123' col = Collection.create(name=collection_name) retrieved_col = Collection.get_loaded_collection(name=collection_name) retrieved_col.set_data(waitForSync=True) retrieved_col.save() col.get() self.assertEqual(col.waitForSync, True) Collection.remove(name=collection_name)
def test_get_collection(self): collection_name = 'test_foo_123' col = Collection.create(name=collection_name) self.assertIsNotNone(col) retrieved_col = Collection.get_loaded_collection(name=collection_name) self.assertEqual(col.id, retrieved_col.id) self.assertEqual(col.name, retrieved_col.name) self.assertEqual(col.type, retrieved_col.type) Collection.remove(name=collection_name)
def test_remove_document_from_collection(self): collection_name = 'test_remove_document_from_collection' col = Collection.create(name=collection_name) doc1 = col.create_document() doc1.save() all_documents = col.documents() self.assertEqual(len(all_documents), 1) doc = all_documents[0] doc.delete() all_documents = col.documents() self.assertEqual(len(all_documents), 0) Collection.remove(name=collection_name)
def test_different_document_revisions(self): collection_name = 'test_revision_documents' col = Collection.create(name=collection_name) doc1 = col.create_document() doc1.save() all_documents = col.documents() self.assertEqual(len(all_documents), 1) doc = all_documents[0] self.assertEqual(doc.revision, doc1.revision) doc.foo = 'bar' doc.save() self.assertNotEqual(doc.revision, doc1.revision) Collection.remove(name=collection_name)
def tearDown(self): # They need to be deleted Collection.remove(name=self.test_1_col.name) Collection.remove(name=self.test_2_col.name) Database.remove(name=self.database_name)
def tearDown(self): Collection.remove(name=self.operating_collection) Database.remove(name=self.database_name)
def tearDown(self): Collection.remove(name=self.collection1_name) Collection.remove(name=self.collection2_name) Collection.remove(name=self.coll3_name) Collection.remove(name=self.coll4_name) Database.remove(name=self.database_name)
all_aql_query.execute() # Everything needs to be in one try-catch so we can clean up afterwards try: big_collection_name = 'big_collection' big_collection = Collection.create(big_collection_name) print('All tests are using either %s documents, edges or models' % document_number) # Create first all documents create_big_number_of_documents(big_collection) # Get all documents normally retrieve_normally_documents(big_collection) # Get documents with simple query retrieve_simply_documents(big_collection) # Get documents with aql retrieve_aql_documents(big_collection) # Delete all documents Collection.remove(big_collection_name) except Exception as err: print(err) # Destroy at the end the database Database.remove(database_name)
def tearDown(self): Collection.remove(name=self.operating_collection) Database.remove(name=self.database_name)