From 42bd756c30d16a3e48c7821d0a5d5433de41a506 Mon Sep 17 00:00:00 2001 From: William Kelly Date: Fri, 8 Mar 2013 17:47:40 -0600 Subject: Fix folsom -> grizzly role table migration issues (bug 1119789) Change-Id: Id7e5b3354d9139afa0a69b283924f363847cef56 --- tests/test_sql_upgrade.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests/test_sql_upgrade.py') diff --git a/tests/test_sql_upgrade.py b/tests/test_sql_upgrade.py index 003fb4ec..62c69cc9 100644 --- a/tests/test_sql_upgrade.py +++ b/tests/test_sql_upgrade.py @@ -538,6 +538,23 @@ class SqlUpgradeTests(test.TestCase): self.assertTableColumns("trust_role", ["trust_id", "role_id"]) + def test_fixup_role(self): + session = self.Session() + self.assertEqual(self.schema.version, 0, "DB is at version 0") + self.upgrade(1) + self.insert_dict(session, "role", {"id": "test", "name": "test"}) + self.upgrade(18) + self.insert_dict(session, "role", {"id": "test2", + "name": "test2", + "extra": None}) + r = session.execute('select count(*) as c from role ' + 'where extra is null') + self.assertEqual(r.fetchone()['c'], 2) + self.upgrade(19) + r = session.execute('select count(*) as c from role ' + 'where extra is null') + self.assertEqual(r.fetchone()['c'], 0) + def populate_user_table(self, with_pass_enab=False, with_pass_enab_domain=False): # Populate the appropriate fields in the user -- cgit