added tests for get_or_create

This commit is contained in:
Wilson Júnior 2011-10-19 09:44:49 -02:00
parent f842c90007
commit 8e87648d53

View File

@ -1010,6 +1010,11 @@ class FieldTest(unittest.TestCase):
obj = Product.objects(company=None).first()
self.assertEqual(obj, me)
obj, created = Product.objects.get_or_create(company=None)
self.assertEqual(created, False)
self.assertEqual(obj, me)
def test_reference_query_conversion(self):
"""Ensure that ReferenceFields can be queried using objects and values
of the type of the primary key of the referenced object.