parts/django/tests/modeltests/field_defaults/tests.py
changeset 307 c6bca38c1cbf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/parts/django/tests/modeltests/field_defaults/tests.py	Sat Jan 08 11:20:57 2011 +0530
@@ -0,0 +1,16 @@
+from datetime import datetime
+
+from django.test import TestCase
+
+from models import Article
+
+
+class DefaultTests(TestCase):
+    def test_field_defaults(self):
+        a = Article()
+        now = datetime.now()
+        a.save()
+
+        self.assertTrue(isinstance(a.id, (int, long)))
+        self.assertEqual(a.headline, "Default headline")
+        self.assertTrue((now - a.pub_date).seconds < 5)