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