PageRenderTime 43ms CodeModel.GetById 39ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

/tests/modeltests/field_defaults/tests.py

https://code.google.com/p/mango-py/
Python | 16 lines | 11 code | 5 blank | 0 comment | 0 complexity | c822ce8ee6e73f82f2a5a01e7bf2df40 MD5 | raw file
 1from datetime import datetime
 2
 3from django.test import TestCase
 4
 5from models import Article
 6
 7
 8class 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)