

def test_associate_duplicate_names(self):
    sg1 = self._create_security_group(name='sg1', description='sg1')['security_group']
    self._create_security_group(name='sg1', description='sg1')['security_group']
    net = self._create_network()
    self._create_port(network_id=net['network']['id'], security_groups=[sg1['id']], device_id=UUID_SERVER)
    self.stub_out('nova.db.instance_get_by_uuid', test_security_groups.return_server)
    body = dict(addSecurityGroup=dict(name='sg1'))
    req = fakes.HTTPRequest.blank(('/v2/fake/servers/%s/action' % UUID_SERVER))
    self.assertRaises(webob.exc.HTTPConflict, self.manager._addSecurityGroup, req, UUID_SERVER, body)

dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/tests/unit/api/openstack/compute/test_neutron_security_groups.py TestNeutronSecurityGroupsV21.test_associate_duplicate_names/original