Skip to content

Commit

Permalink
Resync db after registering new models
Browse files Browse the repository at this point in the history
  • Loading branch information
macro1 committed Apr 1, 2015
1 parent 7e97aec commit a81ad18
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions simple_history/tests/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
except ImportError:
from unittest2 import skipUnless

from six.moves import cStringIO as StringIO
import django
try:
from django.contrib.auth import get_user_model
Expand All @@ -17,6 +18,7 @@
from django.db.models.fields.proxy import OrderWrt
from django.test import TestCase
from django.core.files.base import ContentFile
from django.core import management

from simple_history.models import HistoricalRecords, convert_auto_field
from simple_history import register
Expand Down Expand Up @@ -326,6 +328,9 @@ def test_register_custome_records(self):

class CreateHistoryModelTests(TestCase):

def tearDown(self):
management.call_command('syncdb', interactive=False, stdout=StringIO(), stderr=StringIO())

def test_create_history_model_with_one_to_one_field_to_integer_field(self):
records = HistoricalRecords()
records.module = AdminProfile.__module__
Expand All @@ -340,7 +345,7 @@ def test_create_history_model_with_one_to_one_field_to_char_field(self):
records.module = Bookcase.__module__
try:
records.create_history_model(Bookcase)
except:
except Exception:
self.fail("SimpleHistory should handle foreign keys to one to one"
"fields to char fields without throwing an exception.")

Expand All @@ -349,7 +354,7 @@ def test_create_history_model_with_multiple_one_to_ones(self):
records.module = MultiOneToOne.__module__
try:
records.create_history_model(MultiOneToOne)
except:
except Exception:
self.fail("SimpleHistory should handle foreign keys to one to one"
"fields to one to one fields without throwing an "
"exception.")
Expand Down

0 comments on commit a81ad18

Please sign in to comment.