diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-11-08 16:02:24 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-11-08 16:02:24 +0000 |
| commit | 5c4e9dbcadef9a41396d78a1bfc4728db5cd55eb (patch) | |
| tree | 77c055c8c7f6c5fdb3506fa488db8b922cf733eb /tests | |
| parent | 629c1f9ea6931cad51a3a5898799811c971cd517 (diff) | |
| parent | 2eea4553e23ff3c0d4d367316ea634253e11c10a (diff) | |
| download | keystone-5c4e9dbcadef9a41396d78a1bfc4728db5cd55eb.tar.gz keystone-5c4e9dbcadef9a41396d78a1bfc4728db5cd55eb.tar.xz keystone-5c4e9dbcadef9a41396d78a1bfc4728db5cd55eb.zip | |
Merge "Include 'extra' attributes twice (bug 1076120)"
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_backend_sql.py | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/test_backend_sql.py b/tests/test_backend_sql.py index bc318d07..c484f9ea 100644 --- a/tests/test_backend_sql.py +++ b/tests/test_backend_sql.py @@ -155,6 +155,63 @@ class SqlIdentity(SqlTests, test_backend.IdentityTests): user['id'], self.tenant_bar['id']) + def test_update_tenant_returns_extra(self): + """This tests for backwards-compatibility with an essex/folsom bug. + + Non-indexed attributes were returned in an 'extra' attribute, instead + of on the entity itself; for consistency and backwards compatibility, + those attributes should be included twice. + + This behavior is specific to the SQL driver. + + """ + tenant_id = uuid.uuid4().hex + arbitrary_key = uuid.uuid4().hex + arbitrary_value = uuid.uuid4().hex + tenant = { + 'id': tenant_id, + 'name': uuid.uuid4().hex, + arbitrary_key: arbitrary_value} + ref = self.identity_api.create_tenant(tenant_id, tenant) + self.assertEqual(arbitrary_value, ref[arbitrary_key]) + self.assertIsNone(ref.get('extra')) + + tenant['name'] = uuid.uuid4().hex + ref = self.identity_api.update_tenant(tenant_id, tenant) + self.assertEqual(arbitrary_value, ref[arbitrary_key]) + self.assertEqual(arbitrary_value, ref['extra'][arbitrary_key]) + + def test_update_user_returns_extra(self): + """This tests for backwards-compatibility with an essex/folsom bug. + + Non-indexed attributes were returned in an 'extra' attribute, instead + of on the entity itself; for consistency and backwards compatibility, + those attributes should be included twice. + + This behavior is specific to the SQL driver. + + """ + user_id = uuid.uuid4().hex + arbitrary_key = uuid.uuid4().hex + arbitrary_value = uuid.uuid4().hex + user = { + 'id': user_id, + 'name': uuid.uuid4().hex, + 'password': uuid.uuid4().hex, + arbitrary_key: arbitrary_value} + ref = self.identity_api.create_user(user_id, user) + self.assertEqual(arbitrary_value, ref[arbitrary_key]) + self.assertIsNone(ref.get('password')) + self.assertIsNone(ref.get('extra')) + + user['name'] = uuid.uuid4().hex + user['password'] = uuid.uuid4().hex + ref = self.identity_api.update_user(user_id, user) + self.assertIsNone(ref.get('password')) + self.assertIsNone(ref['extra'].get('password')) + self.assertEqual(arbitrary_value, ref[arbitrary_key]) + self.assertEqual(arbitrary_value, ref['extra'][arbitrary_key]) + class SqlToken(SqlTests, test_backend.TokenTests): pass |
