PageRenderTime 29ms CodeModel.GetById 8ms RepoModel.GetById 1ms 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
Possible License(s): BSD-3-Clause
  1. from datetime import datetime
  2. from django.test import TestCase
  3. from models import Article
  4. class DefaultTests(TestCase):
  5. def test_field_defaults(self):
  6. a = Article()
  7. now = datetime.now()
  8. a.save()
  9. self.assertTrue(isinstance(a.id, (int, long)))
  10. self.assertEqual(a.headline, "Default headline")
  11. self.assertTrue((now - a.pub_date).seconds < 5)