neutron/neutron/tests/api/base_security_groups.py
Assaf Muller ddd5df9526 Delete 118~ API tests from Neutron
Deleted tests that duplicate tests from Tempest, according to the
new criteria specified in TESTING.rst.

Follow up steps are detailed here:
https://etherpad.openstack.org/p/neutron-tempest-defork

For reviewers, here's how to get a complete list of network
tests from Tempest. From a Tempest directory, execute:
testr list-tests tempest.api.network | cut -d"[" -f1 | cut -d"." -f4-
I verified that every test removed here actually exists in that list.

Here's a list of patches that modified tests after the fork:
https://etherpad.openstack.org/p/neutron-tempest-defork-patches-since-initial-sync

And the list of tests we care about:
https://etherpad.openstack.org/p/neutron-tempest-defork, Ctrl-F for:
'Tests that should be synced from Neutron'

Related-bug: #1552960

Change-Id: I685291058f221a7ef0b5b7485280cdabceaa4af3
2016-03-10 15:34:08 -05:00

46 lines
1.8 KiB
Python

# Copyright 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from tempest.lib.common.utils import data_utils
from neutron.tests.api import base
class BaseSecGroupTest(base.BaseNetworkTest):
@classmethod
def resource_setup(cls):
super(BaseSecGroupTest, cls).resource_setup()
def _create_security_group(self, **kwargs):
# Create a security group
name = data_utils.rand_name('secgroup-')
group_create_body = self.client.create_security_group(name=name,
**kwargs)
self.addCleanup(self._delete_security_group,
group_create_body['security_group']['id'])
self.assertEqual(group_create_body['security_group']['name'], name)
return group_create_body, name
def _delete_security_group(self, secgroup_id):
self.client.delete_security_group(secgroup_id)
# Asserting that the security group is not found in the list
# after deletion
list_body = self.client.list_security_groups()
secgroup_list = list()
for secgroup in list_body['security_groups']:
secgroup_list.append(secgroup['id'])
self.assertNotIn(secgroup_id, secgroup_list)