

def test_get_instance_security_groups(self):
    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 = sg1._create_network()
    self._create_port(network_id=net['network']['id'], security_groups=[sg1['id'], sg2['id'], sg3['id']], device_id=test_security_groups.FAKE_UUID1)
    expected = [{
        'name': sg1['name'],
    }, {
        'name': sg2['name'],
    }, {
        'name': sg3['id'],
    }]
    security_group_api = self.controller.security_group_api
    sgs = security_group_api.get_instance_security_groups(context.get_admin_context(), instance_obj.Instance(uuid=test_security_groups.FAKE_UUID1))
    self.assertEqual(sgs, 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_instance_security_groups/VarMisuse@60/95 `self`->`sg1`