2010-09-12 20:03:39 +00:00
|
|
|
from datetime import datetime
|
|
|
|
|
|
|
|
from django.test import TestCase
|
2012-07-20 10:45:19 +00:00
|
|
|
from django.utils import six
|
2010-09-12 20:03:39 +00:00
|
|
|
|
2011-10-13 18:04:12 +00:00
|
|
|
from .models import Article
|
2010-09-12 20:03:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
class DefaultTests(TestCase):
|
|
|
|
def test_field_defaults(self):
|
|
|
|
a = Article()
|
|
|
|
now = datetime.now()
|
|
|
|
a.save()
|
|
|
|
|
2013-05-21 09:42:15 +00:00
|
|
|
self.assertIsInstance(a.id, six.integer_types)
|
2010-09-12 20:03:39 +00:00
|
|
|
self.assertEqual(a.headline, "Default headline")
|
2014-10-28 10:02:56 +00:00
|
|
|
self.assertLess((now - a.pub_date).seconds, 5)
|