1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Also test failure case of ProjectState dependency resolution

This commit is contained in:
Andrew Godwin 2013-09-06 12:18:24 -05:00
parent cdeff3acc2
commit be983ee403

View File

@ -1,7 +1,7 @@
from django.test import TestCase
from django.db import models
from django.db.models.loading import BaseAppCache
from django.db.migrations.state import ProjectState, ModelState
from django.db.migrations.state import ProjectState, ModelState, InvalidBasesError
class StateTests(TestCase):
@ -166,3 +166,12 @@ class StateTests(TestCase):
project_state.add_model_state(ModelState.from_model(F))
final_app_cache = project_state.render()
self.assertEqual(len(final_app_cache.get_models()), 6)
# Now make an invalid ProjectState and make sure it fails
project_state = ProjectState()
project_state.add_model_state(ModelState.from_model(A))
project_state.add_model_state(ModelState.from_model(B))
project_state.add_model_state(ModelState.from_model(C))
project_state.add_model_state(ModelState.from_model(F))
with self.assertRaises(InvalidBasesError):
project_state.render()