summaryrefslogtreecommitdiffstats
path: root/tests/test_sql_upgrade.py
diff options
context:
space:
mode:
authorDolph Mathews <dolph.mathews@gmail.com>2012-11-08 15:00:55 -0600
committerDolph Mathews <dolph.mathews@gmail.com>2012-11-08 15:00:55 -0600
commit28c52ac987baa840b770e1690b2db575cd92edf4 (patch)
tree3d22faca5017db3cc75ddc8674f8161cf19727b9 /tests/test_sql_upgrade.py
parent9916227f9739aadd674e889d62ef539af64e3390 (diff)
downloadkeystone-28c52ac987baa840b770e1690b2db575cd92edf4.tar.gz
keystone-28c52ac987baa840b770e1690b2db575cd92edf4.tar.xz
keystone-28c52ac987baa840b770e1690b2db575cd92edf4.zip
Improve feedback on test failure
Change-Id: Iace6a88ddfbdefe97e0ea205cda4b10c04bca0dc
Diffstat (limited to 'tests/test_sql_upgrade.py')
-rw-r--r--tests/test_sql_upgrade.py20
1 files changed, 6 insertions, 14 deletions
diff --git a/tests/test_sql_upgrade.py b/tests/test_sql_upgrade.py
index 833a73e7..945c90b3 100644
--- a/tests/test_sql_upgrade.py
+++ b/tests/test_sql_upgrade.py
@@ -47,25 +47,17 @@ class SqlUpgradeTests(test.TestCase):
def test_blank_db_to_start(self):
self.assertFalse(self.is_user_table_created(),
- "User should not be defined yet")
+ "User should not be defined yet")
def test_start_version_0(self):
version = migration.db_version()
self.assertEqual(version, 0, "DB is at version 0")
- def assertTableColumns(self, name, expected_cols):
- """
- Confirms that the set of columns expected match the actual based on
- name and number of columns
- """
- table = self.select_table(name)
- self.assertEqual(len(table.columns), len(expected_cols))
- col_names = []
- for col in table.columns:
- col_names.append(col.name)
- for expected_col in expected_cols:
- self.assertIn(expected_col, col_names,
- "column %s not defined" % expected_col)
+ def assertTableColumns(self, table_name, expected_cols):
+ """Asserts that the table contains the expected set of columns."""
+ table = self.select_table(table_name)
+ actual_cols = [col.name for col in table.columns]
+ self.assertEqual(expected_cols, actual_cols, '%s table' % table_name)
def test_upgrade_0_to_1(self):
self.assertEqual(self.schema.version, 0, "DB is at version 0")