

def test_get_instances_security_groups_bindings(self):
    servers = [{
        'id': test_security_groups.FAKE_UUID1,
    }, {
        'id': test_security_groups.FAKE_UUID2,
    }]
    sg1 = self._create_sg_template(name='test1').get('security_group')
    sg2 = self._create_sg_template(name='test2').get('security_group')
    sg3 = self._create_sg_template(name='').get('security_group')
    net = self._create_network()
    self._create_port(network_id=net['network']['id'], security_groups=[sg1['id'], servers['id']], device_id=test_security_groups.FAKE_UUID1)
    self._create_port(network_id=net['network']['id'], security_groups=[sg2['id'], sg3['id']], device_id=test_security_groups.FAKE_UUID2)
    expected = {
        test_security_groups.FAKE_UUID1: [{
            'name': sg1['name'],
        }, {
            'name': sg2['name'],
        }],
        test_security_groups.FAKE_UUID2: [{
            'name': sg2['name'],
        }, {
            'name': sg3['id'],
        }],
    }
    security_group_api = self.controller.security_group_api
    bindings = security_group_api.get_instances_security_groups_bindings(context.get_admin_context(), servers)
    self.assertEqual(bindings, expected)

dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/tests/unit/api/openstack/compute/test_neutron_security_groups.py TestNeutronSecurityGroupsV21.test_get_instances_security_groups_bindings/VarMisuse@114/175 `sg2`->`servers`