2010-09-12 20:03:39 +00:00
|
|
|
from datetime import datetime
|
|
|
|
|
|
|
|
from django.test import TestCase
|
|
|
|
|
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()
|
|
|
|
|
2016-12-29 15:27:49 +00:00
|
|
|
self.assertIsInstance(a.id, int)
|
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)
|