From ebcf4dc5b1fb69aaa21a6e06001854e3843f4967 Mon Sep 17 00:00:00 2001 From: Zhenguo Niu Date: Fri, 17 May 2013 16:23:50 +0800 Subject: [PATCH] Add update method of security group name and description make it possible to edit the name and description of common security groups, we can not rename the default. Fixes: bug #918393 Change-Id: Id6e02cd1054452889282b3ff4fb04b2071980cc8 --- nova/tests/test_db_api.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/nova/tests/test_db_api.py b/nova/tests/test_db_api.py index 4afefdfc..6fef9a5f 100644 --- a/nova/tests/test_db_api.py +++ b/nova/tests/test_db_api.py @@ -1110,6 +1110,19 @@ class DbApiTestCase(DbTestCase): ec2_id = db.get_ec2_snapshot_id_by_uuid(self.context, 'fake-uuid') self.assertEqual(ref['id'], ec2_id) + def test_security_group_update(self): + ctxt = context.get_admin_context() + values = {'security_group': {'tenant_id': '123', + 'name': 'test', 'description': 'test-description'}} + sg = db.security_group_create(ctxt, values) + + values['security_group']['name'] = 'test_name' + values['security_group']['description'] = 'test_desc' + sg = db.security_group_update(ctxt, sg['id'], values) + self.assertNotEqual(None, sg) + self.assertEqual(sg['security_group']['name'], 'test_name') + self.assertEqual(sg['security_group']['description'], 'test_desc') + def test_bw_usage_calls(self): ctxt = context.get_admin_context() now = timeutils.utcnow()