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

Commit

Permalink
Added test for retrieving a single object
Browse files Browse the repository at this point in the history
  • Loading branch information
Sascha Häusler committed Oct 2, 2014
1 parent 8b09450 commit 121694d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions arangodb/tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import unittest
import datetime
from uuid import uuid4

from arangodb.api import Client, Database, Collection, Document
from arangodb.orm.fields import CharField, ForeignKeyField, NumberField, DatetimeField, DateField, BooleanField
Expand Down Expand Up @@ -501,6 +502,27 @@ def setUp(self):
def tearDown(self):
Database.remove(name=self.database_name)

def test_retrieve_one_specifc_model(self):

class TestModel(CollectionModel):
uuid = CharField(null=False)

TestModel.init()

model1 = TestModel()
model1.uuid = str(uuid4())
model1.save()

model2 = TestModel()
model2.uuid = str(uuid4())
model2.save()

specific_model = TestModel.objects.get(uuid=model2.uuid)

self.assertEqual(specific_model.uuid, model2.uuid)

TestModel.destroy()

def test_retrieve_all_models(self):

class TestModel(CollectionModel):
Expand Down

0 comments on commit 121694d

Please sign in to comment.