Add test of remove all security groups in test_server_actions.py

If you omit the attribute of security_groups, the API creates the server
in the default security group,and also openstack can accept to
remove all security groups of server ,so add the test.

Change-Id: I39e272f7b7655a9821cc5ff9e5701f9da80c9bd4
This commit is contained in:
lianghao 2017-04-01 15:34:26 +08:00
parent 076d412210
commit fd8d315e8e
1 changed files with 12 additions and 0 deletions

View File

@ -145,6 +145,18 @@ class ServerActionsTestJSON(base.BaseV2ComputeTest):
# The server should be signaled to reboot gracefully
self._test_reboot_server('SOFT')
@decorators.idempotent_id('1d1c9104-1b0a-11e7-a3d4-fa163e65f5ce')
def test_remove_server_all_security_groups(self):
server = self.create_test_server(wait_until='ACTIVE')
# Remove all Security group
self.client.remove_security_group(
server['id'], name=server['security_groups'][0]['name'])
# Verify all Security group
server = self.client.show_server(server['id'])['server']
self.assertNotIn('security_groups', server)
def _rebuild_server_and_check(self, image_ref):
rebuilt_server = (self.client.rebuild_server(self.server_id, image_ref)
['server'])