django/tests/field_defaults/tests.py

20 lines
466 B
Python
Raw Normal View History

from __future__ import absolute_import
from datetime import datetime
from django.test import TestCase
2012-07-20 18:45:19 +08:00
from django.utils import six
from .models import Article
class DefaultTests(TestCase):
def test_field_defaults(self):
a = Article()
now = datetime.now()
a.save()
self.assertIsInstance(a.id, six.integer_types)
self.assertEqual(a.headline, "Default headline")
self.assertTrue((now - a.pub_date).seconds < 5)