Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Commit

Permalink
Starting with traverser testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Sascha Häusler committed Sep 18, 2014
1 parent d7467d5 commit 9bfb8c6
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
1 change: 0 additions & 1 deletion arangodb/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,6 @@ def create(cls, collection, from_doc, to_doc, edge_data={}):
try:
data = api.edge.post(data=edge_data, **parameters)
except Exception as err:
print(err.content)
raise err

doc = Edge(
Expand Down
37 changes: 36 additions & 1 deletion arangodb/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from arangodb.api import Client, Database, Collection, Document
from arangodb.orm.fields import CharField, ForeignKeyField
from arangodb.orm.models import CollectionModel
from arangodb.query.advanced import Query
from arangodb.query.advanced import Query, Traveser
from arangodb.query.utils.document import create_document_from_result_dict
from query.simple import SimpleQuery
from transaction.controller import Transaction, TransactionController
Expand Down Expand Up @@ -194,6 +194,41 @@ def test_get_all_documents(self):
self.assertNotEqual(doc1, doc2)


class TraveserTestCase(ExtendedTestCase):
def setUp(self):
self.database_name = 'testcase_simple_query_123'
self.db = Database.create(name=self.database_name)

# Create collections
self.test_1_doc_col = self.db.create_collection('doc_col_1')
self.test_1_edge_col = self.db.create_collection('edge_col_1', type=3)

# Create test data
self.doc1 = self.test_1_doc_col.create_document()
self.doc1.ta='fa'
self.doc1.save()

self.doc2 = self.test_1_doc_col.create_document()
self.doc2.ta='foo'
self.doc2.save()

# Create test relation
self.edge1 = self.test_1_edge_col.create_edge(from_doc=self.doc1, to_doc=self.doc2, edge_data={
'data': 'in_between'
})

def tearDown(self):
# They need to be deleted
Collection.remove(name=self.test_1_doc_col.name)
Collection.remove(name=self.test_1_edge_col.name)

Database.remove(name=self.database_name)

def test_traverse_relation(self):
pass
# Traveser.follow(start_vertex='', edge_collection='', direction='')


class CollectionModelTestCase(unittest.TestCase):
def setUp(self):
self.database_name = 'testcase_collection_model_123'
Expand Down

0 comments on commit 9bfb8c6

Please sign in to comment.