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
This commit is contained in:
Zhenguo Niu
2013-05-17 16:23:50 +08:00
committed by niu-zglinux
parent 72cefc37b3
commit ebcf4dc5b1

View File

@@ -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()