changeset 307 | c6bca38c1cbf |
306:5ff1fc726848 | 307:c6bca38c1cbf |
---|---|
1 from datetime import datetime |
|
2 |
|
3 from django.test import TestCase |
|
4 |
|
5 from models import Article |
|
6 |
|
7 |
|
8 class DefaultTests(TestCase): |
|
9 def test_field_defaults(self): |
|
10 a = Article() |
|
11 now = datetime.now() |
|
12 a.save() |
|
13 |
|
14 self.assertTrue(isinstance(a.id, (int, long))) |
|
15 self.assertEqual(a.headline, "Default headline") |
|
16 self.assertTrue((now - a.pub_date).seconds < 5) |