Exemplo n.º 1
0
    def setUp(self):
        self.database_name = 'testcase_aqlquery_123'
        self.db = Database.create(name=self.database_name)

        self.test_1_col = self.db.create_collection('foo_1')
        self.test_2_col = self.db.create_collection('foo_2')

        self.col1_doc1 = self.test_1_col.create_document()
        self.col1_doc1.little_number = 33
        self.col1_doc1.loved = False
        self.col1_doc1.small_text = "lll aa"
        self.col1_doc1.save()

        self.col1_doc2 = self.test_1_col.create_document()
        self.col1_doc2.little_number = 1
        self.col1_doc2.loved = False
        self.col1_doc2.small_text = "aaa aa"
        self.col1_doc2.save()

        self.col1_doc3 = self.test_1_col.create_document()
        self.col1_doc3.little_number = 3
        self.col1_doc3.loved = True
        self.col1_doc3.small_text = "xxx tt"
        self.col1_doc3.save()

        self.col2_doc1 = self.test_2_col.create_document()
        self.col2_doc1.little_number = 33
        self.col2_doc1.loved = False
        self.col2_doc1.save()

        self.col2_doc2 = self.test_2_col.create_document()
        self.col2_doc2.little_number = 11
        self.col2_doc2.loved = True
        self.col2_doc2.save()
Exemplo n.º 2
0
    def setUp(self):

        self.database_name = 'testcase_index_222_123'
        self.db = Database.create(name=self.database_name)

        self.operating_collection = 'bar_extra'
        self.test_1_col = Collection.create(name=self.operating_collection)
Exemplo n.º 3
0
    def setUp(self):

        self.database_name = 'testcase_index_222_123'
        self.db = Database.create(name=self.database_name)

        self.operating_collection = 'bar_extra'
        self.test_1_col = Collection.create(name=self.operating_collection)
Exemplo n.º 4
0
    def setUp(self):

        self.database_name = 'testcase_transaction_123'
        self.db = Database.create(name=self.database_name)

        self.operating_collection = 'foo_test'
        self.test_1_col = Collection.create(name=self.operating_collection)
Exemplo n.º 5
0
    def setUp(self):

        self.database_name = 'testcase_transaction_123'
        self.db = Database.create(name=self.database_name)

        self.operating_collection = 'foo_test'
        self.test_1_col = Collection.create(name=self.operating_collection)
Exemplo n.º 6
0
    def test_create_and_delete_database(self):

        database_name = 'test_foo_123'

        db = Database.create(name=database_name)

        self.assertIsNotNone(db)

        Database.remove(name=database_name)
Exemplo n.º 7
0
    def setUp(self):
        self.database_name = 'testcase_simple_index_query_123'
        self.db = Database.create(name=self.database_name)

        # Create test data
        self.test_1_col = self.db.create_collection('foo_1')

        self.hash_index = Index(self.test_1_col, HashIndex(fields=[
            'username'
        ]))

        self.geo_index = Index(self.test_1_col, GeoIndex(fields=['latitude', 'longitude'], geo_json=False))

        self.fulltext_index = Index(self.test_1_col, FulltextIndex(fields=['description'], minimum_length=4))

        self.skiplist_index = Index(self.test_1_col, SkiplistIndex(fields=['rated'], unique=False))

        self.hash_index.save()
        self.geo_index.save()
        self.fulltext_index.save()
        self.skiplist_index.save()

        self.col1_doc1 = self.test_1_col.create_document()
        self.col1_doc1.username='******'
        self.col1_doc1.description='Paris is such a beautiful city'
        self.col1_doc1.city= 'Paris'
        self.col1_doc1.latitude= 48.853333
        self.col1_doc1.longitude= 2.348611
        self.col1_doc1.rated= 4
        self.col1_doc1.save()

        self.col1_doc2 = self.test_1_col.create_document()
        self.col1_doc2.username='******'
        self.col1_doc2.description='The next time I will get myself some tickets for this event'
        self.col1_doc2.city='Koeln'
        self.col1_doc2.latitude= 50.933333
        self.col1_doc2.longitude=6.95
        self.col1_doc2.rated= 4
        self.col1_doc2.save()

        self.col1_doc3 = self.test_1_col.create_document()
        self.col1_doc3.username='******'
        self.col1_doc3.description='I have never seen such a big door in a city'
        self.col1_doc3.city='Berlin'
        self.col1_doc3.latitude=52.524167
        self.col1_doc3.longitude=13.410278
        self.col1_doc3.rated= 8
        self.col1_doc3.save()

        self.col1_doc4 = self.test_1_col.create_document()
        self.col1_doc4.username='******'
        self.col1_doc4.description='It one of the best cities in the world'
        self.col1_doc4.city='Rome'
        self.col1_doc4.latitude=41.891667
        self.col1_doc4.longitude=12.511111
        self.col1_doc4.rated= 10
        self.col1_doc4.save()
Exemplo n.º 8
0
    def test_create_and_delete_database(self):

        database_name = 'test_foo_123'

        db = Database.create(name=database_name)

        self.assertIsNotNone(db)

        Database.remove(name=database_name)
Exemplo n.º 9
0
    def setUp(self):
	self.database_name = 'testcase_int_abc'
	self.collection1_name = 'int32_collection_abc'
	self.collection2_name = 'int64_collection_xyz'
	self.coll3_name = 'dec10_coll_123'
	self.coll4_name = 'dec20_col2_456'
	self.db = Database.create(name=self.database_name)
	self.col1 = self.db.create_collection(self.collection1_name)
	self.col2 = self.db.create_collection(self.collection2_name)
	self.col3 = self.db.create_collection(self.coll3_name)
	self.col4 = self.db.create_collection(self.coll4_name)
Exemplo n.º 10
0
    def setUp(self):
        self.database_name = 'testcase_simple_query_123'
        self.db = Database.create(name=self.database_name)

        # Create test data
        self.test_1_col = self.db.create_collection('foo_1')
        self.test_2_col = self.db.create_collection('foo_2')

        self.col1_doc1 = self.test_1_col.create_document()
        self.col1_doc1.ta='fa'
        self.col1_doc1.bla='aaa'
        self.col1_doc1.save()

        self.col1_doc2 = self.test_1_col.create_document()
        self.col1_doc2.ta='fa'
        self.col1_doc2.bla='xxx'
        self.col1_doc2.save()

        self.col2_doc1 = self.test_2_col.create_document()
        self.col2_doc1.save()
Exemplo n.º 11
0
    def setUp(self):
        self.database_name = 'testcase_simple_query_123'
        self.db = Database.create(name=self.database_name)

        # Create test data
        self.test_1_col = self.db.create_collection('foo_1')
        self.test_2_col = self.db.create_collection('foo_2')

        self.col1_doc1 = self.test_1_col.create_document()
        self.col1_doc1.ta = 'fa'
        self.col1_doc1.bla = 'aaa'
        self.col1_doc1.save()

        self.col1_doc2 = self.test_1_col.create_document()
        self.col1_doc2.ta = 'fa'
        self.col1_doc2.bla = 'xxx'
        self.col1_doc2.save()

        self.col2_doc1 = self.test_2_col.create_document()
        self.col2_doc1.save()
Exemplo n.º 12
0
    def setUp(self):
        self.database_name = 'testcase_traverser_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()

        self.doc3 = self.test_1_doc_col.create_document()
        self.doc3.ta='bar'
        self.doc3.save()

        self.doc4 = self.test_1_doc_col.create_document()
        self.doc4.ta='extra'
        self.doc4.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'
        })

        self.edge2 = self.test_1_edge_col.create_edge(from_doc=self.doc1, to_doc=self.doc3, edge_data={
            'data': 'xxx'
        })

        self.edge3 = self.test_1_edge_col.create_edge(from_doc=self.doc1, to_doc=self.doc4, edge_data={
            'data': 'dd'
        })

        self.edge4 = self.test_1_edge_col.create_edge(from_doc=self.doc2, to_doc=self.doc4, edge_data={
            'data': 'aa'
        })
Exemplo n.º 13
0
    def setUp(self):
        self.database_name = 'testcase_traverser_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()

        self.doc3 = self.test_1_doc_col.create_document()
        self.doc3.ta = 'bar'
        self.doc3.save()

        self.doc4 = self.test_1_doc_col.create_document()
        self.doc4.ta = 'extra'
        self.doc4.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'})

        self.edge2 = self.test_1_edge_col.create_edge(
            from_doc=self.doc1, to_doc=self.doc3, edge_data={'data': 'xxx'})

        self.edge3 = self.test_1_edge_col.create_edge(from_doc=self.doc1,
                                                      to_doc=self.doc4,
                                                      edge_data={'data': 'dd'})

        self.edge4 = self.test_1_edge_col.create_edge(from_doc=self.doc2,
                                                      to_doc=self.doc4,
                                                      edge_data={'data': 'aa'})
Exemplo n.º 14
0
 def setUp(self):
     self.database_name = 'testcase_collection_model_foreign_key_field_123'
     self.db = Database.create(name=self.database_name)
Exemplo n.º 15
0

##################################
# These tests
##################################

# Init client
from arangodb.query.advanced import Query
from arangodb.query.simple import SimpleQuery

client = Client('arango.nix.bra')

# Create database in which all collections are created
database_name = 'arangopy_speed_test_database'
try:
    Database.create(database_name)
except:
    client.set_database(database_name)


timer = timeit.default_timer

def timer_decorator(message):
    def outer_wrapper(func):
        def wrapper(*args, **kwargs):
            start = timer()
            func(*args, **kwargs)
            elapsed = timer() - start
            print(message % elapsed)

        return wrapper
Exemplo n.º 16
0
 def setUp(self):
     self.database_name = 'test_case_list_field_123'
     self.db = Database.create(name=self.database_name)
Exemplo n.º 17
0
 def setUp(self):
     self.database_name = 'testcase_collection_model_foreign_key_field_123'
     self.db = Database.create(name=self.database_name)
Exemplo n.º 18
0
    def setUp(self):
        self.database_name = 'only_foreign_key_field_123'
        self.db = Database.create(name=self.database_name)

        ForeignkeyFieldTestCase.TestModel.init()
Exemplo n.º 19
0
 def setUp(self):
     self.database_name = 'only_many_to_many_field_123'
     self.db = Database.create(name=self.database_name)
Exemplo n.º 20
0
    def setUp(self):

        self.database_name = 'testcase_user_123'
        self.db = Database.create(name=self.database_name)
Exemplo n.º 21
0
    def setUp(self):
        self.database_name = 'testcase_simple_index_query_123'
        self.db = Database.create(name=self.database_name)

        # Create test data
        self.test_1_col = self.db.create_collection('foo_1')

        self.hash_index = Index(self.test_1_col,
                                HashIndex(fields=['username']))

        self.geo_index = Index(
            self.test_1_col,
            GeoIndex(fields=['latitude', 'longitude'], geo_json=False))

        self.fulltext_index = Index(
            self.test_1_col,
            FulltextIndex(fields=['description'], minimum_length=4))

        self.skiplist_index = Index(
            self.test_1_col, SkiplistIndex(fields=['rated'], unique=False))

        self.hash_index.save()
        self.geo_index.save()
        self.fulltext_index.save()
        self.skiplist_index.save()

        self.col1_doc1 = self.test_1_col.create_document()
        self.col1_doc1.username = '******'
        self.col1_doc1.description = 'Paris is such a beautiful city'
        self.col1_doc1.city = 'Paris'
        self.col1_doc1.latitude = 48.853333
        self.col1_doc1.longitude = 2.348611
        self.col1_doc1.rated = 4
        self.col1_doc1.save()

        self.col1_doc2 = self.test_1_col.create_document()
        self.col1_doc2.username = '******'
        self.col1_doc2.description = 'The next time I will get myself some tickets for this event'
        self.col1_doc2.city = 'Koeln'
        self.col1_doc2.latitude = 50.933333
        self.col1_doc2.longitude = 6.95
        self.col1_doc2.rated = 4
        self.col1_doc2.save()

        self.col1_doc3 = self.test_1_col.create_document()
        self.col1_doc3.username = '******'
        self.col1_doc3.description = 'I have never seen such a big door in a city'
        self.col1_doc3.city = 'Berlin'
        self.col1_doc3.latitude = 52.524167
        self.col1_doc3.longitude = 13.410278
        self.col1_doc3.rated = 8
        self.col1_doc3.save()

        self.col1_doc4 = self.test_1_col.create_document()
        self.col1_doc4.username = '******'
        self.col1_doc4.description = 'It one of the best cities in the world'
        self.col1_doc4.city = 'Rome'
        self.col1_doc4.latitude = 41.891667
        self.col1_doc4.longitude = 12.511111
        self.col1_doc4.rated = 10
        self.col1_doc4.save()
Exemplo n.º 22
0
 def setUp(self):
     self.database_name = 'only_many_to_many_field_123'
     self.db = Database.create(name=self.database_name)
Exemplo n.º 23
0
    def setUp(self):
        self.database_name = 'only_foreign_key_field_123'
        self.db = Database.create(name=self.database_name)

        ForeignkeyFieldTestCase.TestModel.init()
Exemplo n.º 24
0
    def setUp(self):

        self.database_name = 'testcase_user_123'
        self.db = Database.create(name=self.database_name)
Exemplo n.º 25
0
 def setUp(self):
     self.database_name = 'test_case_dict_field_123'
     self.db = Database.create(name=self.database_name)
Exemplo n.º 26
0
 def setUp(self):
     self.database_name = 'testcase_collection_model_123'
     self.db = Database.create(name=self.database_name)
Exemplo n.º 27
0
 def setUp(self):
     self.database_name = 'testcase_collection_model_manager_for_index_123'
     self.db = Database.create(name=self.database_name)