def test_get_document_not_exist(self): """Test get document""" inst_doc = Document(self.db_inst.collection) with self.assertRaises(gmap_exceptions.DocumentNotExist): inst_doc.get_document('doc04')
def test_delete_document(self): """Test get document""" col_name = 'test_collection_db' self._import_bulk(col_name) inst_doc = Document(self.db_inst.collection) inst_doc.delete_document('doc04') with self.assertRaises(gmap_exceptions.DocumentNotExist): inst_doc.get_document('doc04')
def test_get_document(self): """Test get document""" self._import_bulk('test_collection_db') inst_doc = Document(self.db_inst.collection) doc = inst_doc.get_document('doc04') doc = {'_key': doc['_key'], 'value': doc['value'], } self.assertDictEqual(doc, {'_key': 'doc04', 'value': 1})
def get_edge(name, key): """Get edge from Database""" constructor = Constructor() inst_edge = constructor.factory(kind='Edges', name=name) inst_doc = Document(inst_edge) doc = inst_doc.get_document(key) return doc
def get_document(name, key): """Get document from Database""" constructor = Constructor() inst_coll = constructor.factory(kind='Collection', name=name) inst_doc = Document(inst_coll) doc = inst_doc.get_document(key) return doc
def test_get_document(self): """Test get document""" with self.app.app_context(): self._import_bulk('test_collection_db') inst_doc = Document(self.db_inst.collection) doc = inst_doc.get_document('doc04') doc = {'_key': doc['_key'], 'value': doc['value'], } self.assertDictEqual(doc, {'_key': 'doc04', 'value': 1})