def test_has_table(self): """Testing DatabaseState.has_table""" database_state = DatabaseState(db_name='default', scan=False) self.assertFalse(database_state.has_table('my_test_table')) database_state.add_table('my_test_table') self.assertTrue(database_state.has_table('my_test_table'))
def test_rescan_indexes(self): """Testing DatabaseState.rescan_indexes""" database_state = DatabaseState(db_name='default') # Check that a few known tables are in the list, to make sure # the scan worked. for table_name in ('django_content_type', 'django_evolution', 'django_project_version'): self.assertTrue(database_state.has_table(table_name)) # Check the Evolution model. indexes = [ (index_state.columns, index_state.unique) for index_state in database_state.iter_indexes('django_evolution') ] self.assertIn((['version_id'], False), indexes)