def test_handles_duplicate_migration_numbers(self, get_applied_migrations, get_all_migrations): get_applied_migrations.return_value = { 'dupes': ['0001.sql', '0002_foo.sql'], } get_all_migrations.return_value = { 'dupes': [(1, '0001.sql'), (2, '0002_bar.sql'), (2, '0002_foo.sql')], } path = join(mig_root, 'multidb') results = dict(get_pending_migrations(path)) get_applied_migrations.assert_called_once_with(None) get_all_migrations.assert_called_once_with(path, None) self.assertEquals(len(results), 1) self.assertTrue('dupes' in results) self.assertEquals(len(results['dupes']), 1) self.assertTrue('0002_bar.sql' in results['dupes'])