示例#1
0
    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')
示例#2
0
    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')
示例#3
0
    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')
示例#4
0
    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')
示例#5
0
    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})
示例#6
0
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
示例#7
0
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
示例#8
0
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
示例#9
0
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
示例#10
0
    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})