diff options
| author | Loic Bistuer <loic.bistuer@gmail.com> | 2014-03-25 22:02:51 +0800 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-03-25 10:34:28 -0400 |
| commit | bf69375c4d2eaec4f00c646b9e7e84a9397d1a20 (patch) | |
| tree | dde8f2037ade7c5b060a71c05c5e36ef5e924980 /tests | |
| parent | ddcbde41eec12f7a84b00635cdbf1c93d4e4d297 (diff) | |
[1.7.x] Fixed #22331 -- Fixed migrations ProjectState to ignore unmanaged models.
Backport of 69d4b1c3ea from master
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/migrations/test_state.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/migrations/test_state.py b/tests/migrations/test_state.py index 10f5e7d9ab..80ae8922bf 100644 --- a/tests/migrations/test_state.py +++ b/tests/migrations/test_state.py @@ -52,11 +52,22 @@ class StateTests(TestCase): verbose_name = "tome" db_table = "test_tome" + class Unmanaged(models.Model): + title = models.CharField(max_length=1000) + + class Meta: + app_label = "migrations" + apps = new_apps + managed = False + project_state = ProjectState.from_apps(new_apps) author_state = project_state.models['migrations', 'author'] author_proxy_state = project_state.models['migrations', 'authorproxy'] sub_author_state = project_state.models['migrations', 'subauthor'] book_state = project_state.models['migrations', 'book'] + # unmanaged models should not appear in migrations + with self.assertRaises(KeyError): + project_state.models['migrations', 'unmanaged'] self.assertEqual(author_state.app_label, "migrations") self.assertEqual(author_state.name, "Author") |
