def test_include_migration_multiple_names(self): linter = MigrationLinter(include_name=("0002_foo", "0003_bar")) self.assertTrue( linter.should_ignore_migration("app_correct", "0001_initial")) self.assertFalse( linter.should_ignore_migration("app_correct", "0002_foo")) self.assertFalse( linter.should_ignore_migration("app_correct", "0003_bar"))
def test_ignore_applied_migrations(self): linter = MigrationLinter(only_unapplied_migrations=True) linter.migration_loader.applied_migrations = {("app_correct", "0002_foo")} self.assertFalse( linter.should_ignore_migration("app_correct", "0001_initial")) self.assertTrue( linter.should_ignore_migration("app_correct", "0002_foo"))
def test_ignore_migration_full_name(self): linter = MigrationLinter(ignore_name=("0002_foo", )) self.assertFalse( linter.should_ignore_migration("app_correct", "0001_initial")) self.assertTrue( linter.should_ignore_migration("app_correct", "0002_foo"))
def test_ignore_migration_name_contains(self): linter = MigrationLinter(ignore_name_contains="foo") self.assertFalse( linter.should_ignore_migration("app_correct", "0001_initial")) self.assertTrue( linter.should_ignore_migration("app_correct", "0002_foo"))
def test_ignore_migration_exclude_apps(self): linter = MigrationLinter(exclude_apps=("app_add_not_null_column", )) self.assertFalse(linter.should_ignore_migration("app_correct", "0001")) self.assertFalse(linter.should_ignore_migration("app_correct", "0002")) self.assertTrue( linter.should_ignore_migration("app_add_not_null_column", "0001"))
def test_ignore_migration_full_name(self): linter = MigrationLinter( fixtures.ADD_NOT_NULL_COLUMN_PROJECT, ignore_name=('0001_foo',)) self.assertTrue(linter.should_ignore_migration('test_app', '0001_foo')) self.assertFalse(linter.should_ignore_migration('test_app', '0002_bar'))
def test_ignore_migration_exclude_apps(self): linter = MigrationLinter( fixtures.ADD_NOT_NULL_COLUMN_PROJECT, exclude_apps=('test_app1',)) self.assertTrue(linter.should_ignore_migration('test_app1', '0001')) self.assertFalse(linter.should_ignore_migration('test_app2', '0001'))