parts/django/tests/modeltests/field_defaults/tests.py
author Nishanth Amuluru <nishanth@fossee.in>
Sun, 09 Jan 2011 20:26:11 +0530
changeset 368 a4fa11b2cb5c
parent 307 c6bca38c1cbf
permissions -rw-r--r--
add textbook works fine

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)