summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2011-11-16 20:40:12 +0000
committerGerrit Code Review <review@openstack.org>2011-11-16 20:40:12 +0000
commitc987f78853618e24adb642cd8d76ba6be36ce075 (patch)
tree820d3c2246e72331fac6394b358617e035ba9bad /nova/tests
parent57ad4de6487f625a9e39b17ba612b6f1b43e937c (diff)
parent53e14f578e066c5e9d715e6085d25e47d19ad3f7 (diff)
Merge "Convert security_group calls to use instance objs"
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/api/openstack/contrib/test_security_groups.py13
-rw-r--r--nova/tests/test_compute.py12
2 files changed, 20 insertions, 5 deletions
diff --git a/nova/tests/api/openstack/contrib/test_security_groups.py b/nova/tests/api/openstack/contrib/test_security_groups.py
index b3e1507e0..1e7a439b0 100644
--- a/nova/tests/api/openstack/contrib/test_security_groups.py
+++ b/nova/tests/api/openstack/contrib/test_security_groups.py
@@ -72,20 +72,23 @@ def security_group_rule_db(rule, id=None):
def return_server(context, server_id):
return {'id': int(server_id),
- 'state': 0x01,
+ 'power_state': 0x01,
'host': "localhost",
- 'uuid': FAKE_UUID}
+ 'uuid': FAKE_UUID,
+ 'name': 'asdf'}
def return_server_by_uuid(context, server_uuid):
return {'id': 1,
- 'state': 0x01,
+ 'power_state': 0x01,
'host': "localhost",
- 'uuid': server_uuid}
+ 'uuid': server_uuid,
+ 'name': 'asdf'}
def return_non_running_server(context, server_id):
- return {'id': server_id, 'state': 0x02, 'host': "localhost"}
+ return {'id': server_id, 'power_state': 0x02,
+ 'host': "localhost", 'name': 'asdf'}
def return_security_group_by_name(context, project_id, group_name):
diff --git a/nova/tests/test_compute.py b/nova/tests/test_compute.py
index 0dd6c14b9..69b998d68 100644
--- a/nova/tests/test_compute.py
+++ b/nova/tests/test_compute.py
@@ -2094,6 +2094,18 @@ class ComputeAPITestCase(BaseTestCase):
self.assertFalse(self.compute_api.get_lock(self.context, instance))
db.instance_update(self.context, instance_id, {'locked': True})
self.assertTrue(self.compute_api.get_lock(self.context, instance))
+
+ def test_add_remove_security_group(self):
+ instance_id = self._create_instance()
+ self.compute.run_instance(self.context, instance_id)
+ instance = self.compute_api.get(self.context, instance_id)
+ security_group_name = self._create_group()['name']
+ self.compute_api.add_security_group(self.context,
+ instance,
+ security_group_name)
+ self.compute_api.remove_security_group(self.context,
+ instance,
+ security_group_name)
self.compute_api.delete(self.context, instance)
def test_inject_file(self):