Skip to content

Commit

Permalink
Also test failure case of ProjectState dependency resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgodwin committed Sep 6, 2013
1 parent cdeff3a commit be983ee
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/migrations/test_state.py
@@ -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):
Expand Down Expand Up @@ -166,3 +166,12 @@ class Meta:
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()

0 comments on commit be983ee

Please sign in to comment.