2010-09-13 04:05:07 +08:00
|
|
|
from django.test import TestCase
|
|
|
|
|
2011-10-14 02:04:12 +08:00
|
|
|
from .models import Empty
|
2010-09-13 04:05:07 +08:00
|
|
|
|
|
|
|
|
|
|
|
class EmptyModelTests(TestCase):
|
|
|
|
def test_empty(self):
|
|
|
|
m = Empty()
|
2014-10-28 18:02:56 +08:00
|
|
|
self.assertIsNone(m.id)
|
2010-09-13 04:05:07 +08:00
|
|
|
m.save()
|
2012-09-08 01:17:09 +08:00
|
|
|
Empty.objects.create()
|
2010-09-13 04:05:07 +08:00
|
|
|
self.assertEqual(len(Empty.objects.all()), 2)
|
2014-10-28 18:02:56 +08:00
|
|
|
self.assertIsNotNone(m.id)
|
2010-09-13 04:05:07 +08:00
|
|
|
existing = Empty(m.id)
|
|
|
|
existing.save()
|