From be983ee4031bb91f0a56e310633adbc50d9221a3 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Fri, 6 Sep 2013 12:18:24 -0500 Subject: [PATCH] Also test failure case of ProjectState dependency resolution --- tests/migrations/test_state.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/migrations/test_state.py b/tests/migrations/test_state.py index 2a6fef0ac1..4707349176 100644 --- a/tests/migrations/test_state.py +++ b/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): @@ -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()